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<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main() {
	int num,a=0,b=0,draw;
	cin >> num;
	int *line = new int[num];
	for (int w = 0; w < num; w++) {
		line[w] = w + 1;
	}
		cin >> draw;
		for (int w = 0; w < draw; w++) {
			scanf("%d,%d", &a, &b);
			swap(line[a-1], line[b-1]);
		}
		for (int w = 0; w < num; w++) {
			cout<<line[w]<<endl;
		}
	return 0;
}

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

using namespace std;

int main(void){
  char c;
  int w, n, a, b;
  vector<int> v;
  vector<pair<int, int> > p;

  cin >> w;
  cin >> n;
  for(int i=1; i<=w; i++){
    v.push_back(i);
  }

  for(int i=0; i<n; i++){
    cin >> a >> c >> b;
    p.push_back(make_pair(a, b));
  }

  for(int i=0; i<n; i++){
    swap(v[p[i].first-1], v[p[i].second-1]);
  }

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

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

using namespace std;

int main(void) {
	int w, n, a, b;
	int i;
	int out[31], tmp;

	cin >> w;
	cin >> n;

	for(i=0;i<w;i++) {
		out[i] = i+1;
	}

	for(i=0;i<n;i++) {
		scanf("%d,%d", &a, &b);
		tmp = out[a-1];
		out[a-1] = out[b-1];
		out[b-1] = tmp;
	}

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

	return 0;
}

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

int main() {
  string str;
  char ch;
  int w, n, a, b;
  cin >> w >> n;
  vector<int> num(w, 0);
  for(int i = 0; i < w; i++) num.at(i) = i + 1;
  
  for(int i = 0; i < n; i++){
    cin >> a >> ch >> b;
    swap( num.at(a - 1), num.at(b - 1));
  }
  
  for(int i = 0; i < w; i++) cout << num.at(i) << endl;
}

C++: #include<stdio.h>

int main(){
	int tate,yoko,bou[40][2],j,x,kekka[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30},i=0;
	scanf("%d %d",&tate,&yoko);
	for(j=0;j<yoko;j++){
		scanf("%d",&bou[j][1]);
		printf(",");
		scanf("%d",&bou[j][2]);
	}
	for(i=1;i<tate+1;i++){
		x=i;
		for(j=0;j<yoko;j++){
			if(bou[j][1]==x){
				x=bou[j][2];
			}
			else if(bou[j][2]==x){
				x=bou[j][1];
			}
		}
		kekka[x-1]=i;
	}
	for(j=0;j<tate;j++){
		printf("%d\n",kekka[j]);
	}
}

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

using namespace std;

int main(){

	int n , w;
	int a , b , ary[100];

	cin >> w >> n;

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

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

		int tmp = ary[a];
		ary[a] = ary[b];
		ary[b] = tmp;
	}

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

	return 0;
}

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

int main(){
	int w,n,ans[31],a,b,i;
	cin>>w>>n;
	for(i = 1;i <= w;i++){
		ans[i-1] = i;
	}
	for(i = 1;i <= n;i++){
		scanf("%d,%d",&a,&b);
		swap(ans[a-1],ans[b-1]);
	}
	for(i = 0;i < w;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

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>
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;
		string d[2];
		roop(i, s.length) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		ll 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++: #include <bits/stdc++.h>

using namespace std;

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

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int c[40];
int w,n,a,b;
int main()
{
	cin>>w>>n;
	for(int i=1;i<=w;i++)c[i]=i;		
	for(int i=1;i<=n;i++)
	{
		scanf("%d,%d",&a,&b);
		swap(c[a],c[b]);
	}
	for(int i=1;i<=w;i++)cout<<c[i]<<endl;
	return 0;
}

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

int main() {
	int w, n, x, y;
	string str;
	cin >> w >> n;
	int a[31];
	for (int i = 0; i <= w; i++) {
		a[i] = i;
	}
	for (int i = 0; i < n; i++) {
		cin >> str;
		x = str[0];
		y = str[2];
		cout << x << y << endl;
		int tmp = a[x-48];
		a[x-48] = a[y-48];
		a[y-48] = tmp;
	}
	for (int i = 1; i <= w; i++) {
		cout << a[i] << endl;
	}
	return 0;
}

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


int main()
{
	int w, n, num[32];
	string s;
	cin >> w;
	fill(num, num + 32, 0);
	for (int i = 1; i < w + 1; i++){
		num[i] = i;
	}
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> s;
		string l, r;
		int commapos;

		//カンマの左
		for (int i = 0;; i++){
			if (s[i] == ','){
				commapos = i;
				break;
			}
			else{
				l += s[i];
			}
		}

		//カンマの右
		for (int i = commapos + 1; i < (signed)s.length(); i++){
			r += s[i];
		}
		int left = stoi(l);
		int right = stoi(r);
		int temp = num[left];
		num[left] = num[right];
		num[right] = temp;
	}
	for (int i = 1; i < w + 1; i++){
		cout << num[i] << endl;
	}
	return 0;
}

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

int main(){
	int w;
	int n;
	cin>>w>>n;
	vector<int> x(w);
	for(int i=0;i<w;i++)x[i]=i+1;

	for(int i=0;i<n;i++){
		int a,b;
		(cin>>a).ignore()>>b;
		a--;
		b--;
		int tmp=x[a];
		x[a]=x[b];
		x[b]=tmp;
	}
	for(int i=0;i<w;i++)cout<<x[i]<<endl;
	return 0;
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

void
swap(int* v, int i, int j) {
  int t = v[i];
  v[i] = v[j];
  v[j] = t;
}

int main() {

  int w, n; cin >> w >> n;
  int xs[w];
  rep (i, w) xs[i] = (i+1);
  rep (i, n) {
    char comma;
    int a, b; cin >> a >> comma >> b;
    --a; --b;
    swap(xs, a , b);
  }
  rep (i, w) cout << xs[i] << endl;

  return 0;
}