Go: package main

import "fmt"

func main() {
	var w, n, a, b, i, te int
	var amida [31]int
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)
	for i := 1; i <= w; i++ {
		amida[i] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d,%d", &a, &b)
		te = amida[a]
		amida[a] = amida[b]
		amida[b] = te
	}
	for i := i; i <= w; i++ {
		fmt.Printf("%d\n", amida[i])
	}
}

C++: // 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
#include <typeinfo>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
	ll w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		std::string d[2];
		roop(i, s.length()) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		int swap[2];
		roop(i, 2) {
			swap[i] =stoi(d[i]);
		}
		ll before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
	int w;
	int n;
	int ary[30];

	cin >> w >> n;
	for (int i = 1; i <= w; i++){
		ary[i] = i;
	}

	for (int i = 0; i < n; i++){
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(ary[a], ary[b]);
	}

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


	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main()
{
	char c;
	int w, n;
	cin >> w >> n;
	vector<int> res(w);
	for (int i = 0; i < w; i++) {
		res[i] = i + 1;
	}
	for (int i = 0, a, b; i < n; i++) {
		cin >> a >> c >> b;
		swap(res[a - 1], res[b - 1]);
	}
	for (int i = 0; i < w; i++) {
		cout << res[i] << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
	int w,n, a[30][2],i,c,no,rs[30];
	
	scanf("%d%d",&w,&n);
	for(i = 0; n > i; i++){
		scanf("%d",&a[i][0]);
		getchar();
		scanf("%d",&a[i][1]);
	}
	
	for(i = 1; w >= i; i++){
		no = i;
		for(c = 0; n > c; c++){
			if(a[c][0] == no) no = a[c][1];
			else if(a[c][1] == no) no = a[c][0];
		}
		rs[no-1] = i;
	}
	for(i = 0; w > i; i++){
		printf("%d\n",rs[i]);
	}
	
	return 0;
}

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

int main(void){
	int w,n,x,y,temp;
	int a[31];
	char c;
	string str;
	for(int i = 0; i < 31; i++){
		a[i] = i;
	}
	cin >> w >> n;
	for(int i = 0; i < n; i++){
		cin >> str;
		istringstream is(str);
		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[40];
  for(int i=0; i<40; i++){
    a[i] = i;
  }
  cin >> w >> n;
  for(int i=0; i<n; i++){
    int s,t;
    char c;
    cin >> s >> c >> t;
    swap(a[s],a[t]);
  }
  for(int i=1; i<=w; i++){
    cout << a[i] << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
//#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


signed main() {
	int n, m; cin >> n >> m;
	vector<int> v(n);
	rep(i, n) v[i] = i + 1;
	rep(i, m) {
		string s; cin >> s;
		string s1, s2;
		bool flag = true;
		for (auto a : s) {
			if (a == ',') flag = !flag;
			else if (flag) {
				s1 = s1 + a;
			}
			else {
				s2 = s2 + a;
			}
		}
		int a, b;
		a = stoi(s1);
		b = stoi(s2);
		swap(v[a - 1], v[b - 1]);
	}
	for (auto a : v) {
		cout << a << endl;
	}
}

C++: #include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>

using namespace std;

int sosuu(int n);

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

    }
    
}

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

int main() {
  int w, n;
  cin >> w >> n;
  vector<int> a(n), b(n);
  char c;
  for (int i = 0; i < n; ++i)
    cin >> a[i] >> c >> b[i];

  vector<int> ans(w + 1);
  for (int j = 1; j <= w; ++j)
    ans[j] = j;

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

  for (int j = 1; j <= w; ++j)
    cout << ans[j] << endl;
}

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>>b;
    swap(out[a-1],out[b-1]);
  }
  rep(i,n)cout<<out[i]<<endl;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define INF 1<<25
#define LIM 1000000

using namespace std;

int bar[30];
int w, n;

int main()
{
	cin >> w >> n;
	
	FOR(i,0,w)
	{
		bar[i] = i+1;
	}
	
	FOR(i,0,n)
	{
		int a,b; char c;
		cin >> a >> c >> b;
		
		swap(bar[a-1], bar[b-1]);
	}
	
	FOR(i,0,w)
	{
		cout<<bar[i]<<endl;
	}
	
	
	return 0;
}

C++: #include <iostream>
#include<math.h>
#include <vector>
#include <string>
#include<stdio.h>
using namespace std;

class Amidakuji{

public:
	int W;
	vector<int> array;//????´?1???????????????
	Amidakuji(int w);
	void Swap(int x,int y);
	void call();
};

//????????????????????????????????????
Amidakuji::Amidakuji(int w){

	for (int i = 0; i < w; i++){
		array.push_back(i+1);//[0,1,2,3,4]={1,2,3,4,5}
	}
	
	W = w;

}

void Amidakuji::Swap(int x,int y){

	//???????????£????????????array[]???????????????
	//int?????§???????????£????????§char???int?????????????????????-48;
	x -= 48;
	y -= 48;
	int q;
	q = array[x - 1];
	array[x-1] = array[y-1];
	array[y-1] = q;
	

}

void Amidakuji::call(){

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

}

int main(){

	int w, n;
	string text;

	while (cin >> w>>n){
		cin.ignore();
		//??????????????????????????§???????????????
		Amidakuji Amidakuji(w);
		for (int i = 0; i < n; i++){
			getline(cin, text);
			if (text[0] != 0 && text[2] != 0){
				//???????????????????????????swap???????????????
				Amidakuji.Swap(text[0], text[2]);
				text[0] = text[2] = 0;
			}
		}
	
		//????????????
		Amidakuji.call();
	}


	return 0;
}

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

using namespace std;

void Swap(vector<int>& v, int index1, int index2) {
    int tmp = v[index1];
    v[index1] = v[index2];
    v[index2] = tmp;
}


int main() {
    int w;
    cin >> w;

    vector<int> v(w);
    for(int i = 0; i < v.size(); ++i) {
        v[i] = i + 1;
    }
    
    int n;
    cin >> n;

    for(int i = 0, a, b; i < n; ++i) {
        cin >> a;
        cin.ignore();
        cin >> b;

        Swap(v, a - 1, b - 1);
    }

    for(auto x : v) {
        cout << x << '\n';
    }

    return 0;
}