Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}

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;
}

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

int main(){
    int w;
    int n;

    int a1, a2;
    int tmp;


    cin >> w >> n;

    vector<int> a(w);

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

    for(int i=1; i<=n; i++){
        scanf("%d,%d", &a1, &a2);
        tmp = a[a1-1];
        a[a1-1] = a[a2-1];
        a[a2-1] = tmp;
    }

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

    return 0;
}

C++: #include<iostream>
//#include"Header.h"
using namespace std;
#define size_n 4
#define size_num 30

template<typename T> void show_array(T ar,int ar_size)
{
	for(int i=0;i<ar_size;i++){
		cout << '[' << i << "]=" << ar[i] << ',';
	}
	cout << "\b " << endl;
}

int main(){
	int swap_times;
	int num_length;
	char n[size_n]={'\0'};
	int num[size_num] = {0};
	int temp;
	cin >> num_length;
	cin >> swap_times;

	for(int i=1;i <= num_length;i++){
		num[i] = i;
	}

	for(int i=1;i<=swap_times;i++){
		cin >> n;
		temp					= num[(int)n[0]-(int)'0'];
		num[(int)n[0]-(int)'0'] = num[(int)n[2]-(int)'0'];
		num[(int)n[2]-(int)'0'] = temp;

		//データの初期化
		for(int i=0;i<size_n;i++){
			n[i] = '\0';
		}
	}

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

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main() {
	int array[30];
	int w, n;

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

	for(int i = 0; i < w; i++) {
		cout << array[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;
}