Go: package main

import "fmt"

func main() {
	var w, n int
	fmt.Scan(&w)
	numbers := make([]int, w)

	fmt.Scan(&n)

	intersect := make([][2]int, n)

	for i := 0; i < n; i++ {
		var x, y int
		fmt.Scanf("%d,%d", &x, &y)
		intersect[i] = [2]int{x, y}
	}

	for i := 0; i < w; i++ {
		numbers[i] = i + 1
	}

	for _, v := range intersect {
		swap(numbers, v[0], v[1])
	}

	for _, v := range numbers {
		fmt.Println(v)
	}
}

func swap(arr []int, x, y int) {
	tmp := arr[x-1]
	arr[x-1] = arr[y-1]
	arr[y-1] = tmp
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
int w,n;
cin>>w>>n;
vector<int> number(w);
REP(i, w){
	number[i]=i+1;
}
REP(i,n){
string s,s2;
	getline(cin, s,',');
	getline(cin, s2);
	int a,b;
	a = atoi(s.c_str());
	b = atoi(s2.c_str());
	int t=number[a-1];
	number[a - 1] = number[b-1];
	number[b - 1]=t;
}
REP(i, w)
cout << number[i]<<endl;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int w, n, b, c, p;
	int a[31];

	cin >> w >> n;

	for (int i = 1; i <= w; i++){
		a[i] = i + 1;
	}
	
	for (int i = 1; i <= n; i++){
		scanf("%d,%d", &b, &c);
		p = a[b];
		a[b] = a[c];
		a[c] = p;
	}

	for (int i = 1; i <= w; i++){
		printf("%d\n", a[i] - 1);
	}
}

C++: /*AOJ 0011*/

#include<iostream>
#include<vector>

using namespace std;

int main(){
	int w,n;

	cin>>w;
	cin>>n;

	vector<int> a;
	vector<int> b;

	int ans[30];

	for(int i=0;i<n;i++){
		int tmp1,tmp2;
		scanf("%d,%d",&tmp1,&tmp2);
		a.push_back(tmp1-1);
		b.push_back(tmp2-1);
	}
	/*
	for(int i=0;i<n;i++){
		cout<<a[i]<<" "<<b[i]<<endl;
	}
	*/

	for(int i=0;i<w;i++){
		int point = i;

		for(int j=0;j<n;j++){
			if(point==a[j]){
				point = b[j];
			}
			else if(point==b[j]){
				point = a[j];
			}
		}
		ans[point] = i+1;
	}

	for(int i=0;i<w;i++){
		cout<<ans[i]<<endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;

int main()
{
	int w, n, a[30], b[30], ans[30];
	char dummy;

	cin >> w >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i] >> dummy >> b[i];
	}

	for (int i = 0; i < w; i++)
		ans[i] = i+1;

	for (int i = 0; i < n; i++)
		swap(ans[a[i]-1], ans[b[i]-1]);

	for (int i = 0; i < w; i++)
		cout << ans[i] << endl;

	return 0;
}

C++: #include <cstdio>

int main(){
  int w,n;
  scanf("%d %d",&w,&n);
  int a[w];
  for(int i=0; i<w; i++) a[i]=i+1;
  while(n--){
    int b,c,e;
    scanf("%d,%d",&b,&c);
    e=a[b-1];
    a[b-1]=a[c-1];
    a[c-1]=e;
  }
  for(int i=0; i<w; i++)
    printf("%d\n",a[i]);
}

C++: #include<iostream>
#include<vector>
#include <stdio.h>
int main(){
	int w;
	std::cin>>w;
	std::vector<int> a(w+1);
	for(int i=1;i<=w;i++)a[i]=i;
	int n;
	std::cin>>n;
	while(n>0){
		int b,c;
		scanf("%d,%d",&b,&c);
		//std::cin>>b>>c;
		int d=a[b];
		a[b]=a[c];
		a[c]=d;
		n--;
	}
	for(int i=1;i<=w;i++)std::cout<<a[i]<<std::endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>

int main(){
	int w, n, a[30], b[30], result[30];
    std::cin >> w >> n;
    for(int i=0; i<n; i++){
        (std::cin >> a[i]).ignore() >> b[i];
        a[i]--;
        b[i]--;
    }
    for(int i=0; i<w; i++)
        result[i] = i;
    for(int i=0; i<n; i++)
        std::swap(result[a[i]], result[b[i]]);
    for(int i=0; i<w; i++)
        std::cout << result[i] + 1 << std::endl;
	return 0;
}

C++: #include <iostream>
using namespace std;


int main(){
  int verticals,horizontals,a,b;
  cin >> verticals;
  cin >> horizontals;

  int res[verticals];
  for(int i=0;i<verticals;i++) res[i] = i+1;
  for(int i=0;i<horizontals;i++){
    cin >> a >> b;
    
    int tmp = res[a-1];
    res[a-1] = res[b-1];
    res[b-1] = tmp;
  }
  for(int i=0;i<verticals;i++) cout << res[i] << endl;
}

C++: #include<cstdio>
int main(){
    int w,n;
    scanf("%d%d",&w,&n);
    int *ar=new int[w];
    for(int i=0;i<w;i++){
        ar[i]=i+1;
    }
    for(int i=0;i<n;i++){
        int a,b,t;
        scanf("%d,%d",&a,&b);
        t=ar[a-1];
        ar[a-1]=ar[b-1];
        ar[b-1]=t;
    }
    for(int i=0;i<w;i++){
        printf("%d\n",ar[i]);
    }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
typedef long long int LLI;
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n,m;
  char d;
  cin>>n>>m;
  vector<int>out(n);
  rep(i,n)out[i]=i+1;
  rep(i,m){
    int a,b;
    cin>>a>>d>x>b;
    swap(out[a-1],out[b-1]);
  }
  rep(i,n)cout<<out[i]<<endl;
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>

using namespace std;

typedef long long int lli;

int main() {
	int w, n;
	cin >> w >> n;
	vector<int> ar(w);
	vector<vector<int>> hor(n,vector<int>(2));
	for (int i = 0; i < w; i++) ar[i] += i+1;
	for (int j = 0; j < n;j++) {
		(cin >> hor[j][0]).ignore(1) >> hor[j][1];
		swap(ar[hor[j][0]-1], ar[hor[j][1]-1]);
	}
	for (int i = 0; i < w; i++) cout << ar[i] << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(void){
	int w,n,x,y,temp;
	int a[31];
	char c;
	string str;
	istringstream is(str);
	for(int i = 0; i < 31; i++){
		a[i] = i;
	}
	scanf("%d %d",&w,&n);
	for(int i = 0; i < n; i++){
		getline(str,7);
		is >> x >> c >> y;
		temp = a[x];
		a[x] = a[y];
		a[y] = temp;
	}

	for(int i = 0; i < w; i++){
		cout << a[i + 1] << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	int w, n;
	int a[30], b[30];
	int p, q, r;
	int base[31];

	base[0] = 0;
	w = 0; n = 0;

	cin >> w;
	cin >> n;

	for (int i = 0; i <= w; i++){
		base[i] = i;
	}
	for (int i = 0; i<n; i++){
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i<n; i++){
		p = a[i]; q = b[i];
		r = base[p];
		base[p] = base[q];
		base[q] = r;
	}

	for (int i = 1; i <= w; i++){
		cout << base[i];
		if (i != w){
			cout << " ";
		}
		if (i == w){
			cout << "\n";
		}
	}

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
struct shu
{
int from;
int to;
};
shu nCost[31];
void vmake(int nN,int nC);
int main()
{
	int num,nCase,i;

	while(scanf("%d",&num)==1)
	{
      scanf("%d",&nCase);
	  for(i=1;i<=nCase;i++)
	  {
	    scanf("%d,%d",&nCost[i].from,&nCost[i].to);
	  }
	    vmake(num,nCase);
	 }
	return 0;
}

void vmake(int nN,int nC)
 {
  int i,j,To;
  for(i=1;i<=nN;i++)
  {  
     To=i;
     for(j=nC;j>=1;j--)
	 {
       if(To==nCost[j].from)
	         To=nCost[j].to;
	   else
	      if(To==nCost[j].to)
	         To=nCost[j].from;
	 }
	 printf("%d\n",To);
  }
 }