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++: #include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;


std::vector<std::string> split(std::string str, char del) {
    int first = 0;
    int last = str.find_first_of(del);
 
    std::vector<std::string> result;
 
    while (first < str.size()) {
        std::string subStr(str, first, last - first);
 
        result.push_back(subStr);
 
        first = last + 1;
        last = str.find_first_of(del, first);
 
        if (last == std::string::npos) {
            last = str.size();
        }
    }
 
    return result;
}

int main(){
    int w,n;
    cin >> w >> n;
    vector<int> N(w);
    for(int i=0; i<w; i++) N[i]=i;
    // rep(i,w) cout << N[i]; cout << endl;
    // cout << endl;
    rep(i,n){
        string s;
        cin >> s;
        vector<string> A = split(s, ',');
        string a = A[0], b = A[1];
        // cout << a << " " <<b << endl;
        int tmp=N[stoi(a)-1];
        N[stoi(a)-1]=N[stoi(b)-1];
        N[stoi(b)-1]=tmp;

    }
    rep(i,w) cout << N[i]+1 << endl;
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define EPS 1.0e-8
#define MAX_N 100
typedef pair<int,int> Pii;
typedef pair<int,int> Pis;
const double PI=acos(-1);

int main(){
	int w, n;
	int stage[30];
	int a, b;
	cin >> w >> n;
	rep(i,w) stage[i] = i+1;

	rep(i,n){
		scanf("%d,%d",&a,&b);	
		stage[a-1] ^= stage[b-1];
		stage[b-1] ^= stage[a-1];
		stage[a-1] ^= stage[b-1];
	}

	rep(i,w)	cout << stage[i] << endl;
}

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

int now[30];

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;




int main(void){

int ww,w[32];	
int nn,ra,rb,i;
char cn;
	cin >> ww;
	cin >> nn;
	
	rep(i,ww) w[i]=i+1;
	rep(i,nn){
		cin >> ra >> cn >> rb;
		swap(w[ra-1],w[rb-1]);
	}
	rep(i,ww) cout << w[i] << endl;
	return 0;
}

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

int main(){
  int w,n,i,j;
  int f,t;
  int value[31];
  for(i=1;i<31;i++){
    value[i]=i;
  }
  string str;
  cin >> w >> n;
  for(i=0;i<n;i++){
    cin >> str;
    if(str[1]==','){
      f = str[0] - '0';
      if(str.size()==3) t = str[2] - '0';
      else t = (str[2] - '0') * 10 + str[3] - '0';
    }else{
      f = (str[0] - '0') * 10 +  str[1] - '0';
      if(str.size()==4) t = str[3] - '0';
      else t = (str[3] - '0') * 10 + str[4] - '0';
    }
    int buf=value[f];
    value[f]=value[t];
    value[t]=buf;
  }
  for(i=1;i<w+1;i++){
    cout << value[i] << endl;
  }
}

C++: /*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
int x=0,y=0,z=0,w=0,n=0;
string b;
std::cin >> x;
int a[x+1];
rep(i,x+1){
  a[i]=i;
}
std::cin >> y;
rep(i,y){
scanf("%d,%d",&z,&w);
swap(a[z],a[w]);
}
repone(i,x+1){
  std::cout << a[i] << '\n';
}
}

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

int main()
{
	int line,n;
	char c;
	cin >> line;
	cin >> n;

	int values[31];
	for(int i=0;i<line;i++)
	{
		values[i] = i+1;
	}

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

		int value = values[a-1];
		values[a-1] = values[b-1];
		values[b-1] = value;
	}

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

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

int main(){
  int a[30];
  char gomi;
  int w,n,box1,box2;
  cin >> w >> n;
  for(int i=0;i<w;i++){
    a[i] = i+1;
  }
  for(int i=0;i<n;i++){
    cin >> box1 >> gomi >> box2;
    swap(a[box1-1],a[box2-1]);
  }
  for(int i=0;i<w;i++){
    cout << a[i] << endl;
  }
}

C++: #include<iostream>
#include<stdio.h>
#define N 30
using namespace std;
int main(){
????int w,n,tmp;
????int lod[N]; int lis[N][3];
????while(cin >> n >> w){
????for(int i = 0;i<n;i++){
????????lod[i] = i+1;
????}
??
????for(int i=0;i<w;i++){
????????scanf("%d,%d",&lis[i][0],&lis[i][2]);
????}
????for(int i=0;i<w;i++){
????????tmp = lod[lis[i][0]-1];
????????lod[lis[i][0]-1] = lod[lis[i][2]-1];
????????lod[lis[i][2]-1] = tmp;
????}
????for(int i=0;i<n;i++){
????????cout << lod[i] << endl;
????}
????}
}

C++: #include <iostream>

int main(){
	int a,b,c,g,h;
	char j;
	std::cin>>a>>b;
    int d[a];
    for(int e=1;e<=a;e++){
    	d[e]=e;
    	
	}
	for(int f=0;f<b;f++){
		std::cin>>g>>j>>h;
		c=d[g];
		d[g]=d[h];
		d[h]=c;
	}
	for(int i=1;i<=a;i++){
		std::cout<<d[i]<<std::endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>

#define EPS 1e-6
using namespace std;

double cross(complex<double> a, complex<double> b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(complex<double> a, complex<double> b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  int W, N;
  scanf(" %d %d ", &W, &N);
  vector<pair<int, int> > lines;
  for (int i = 0; i < N; i++) {
    int x, y;
    scanf(" %d,%d ", &x, &y);
    lines.push_back(make_pair(x, y));
  }
  reverse(lines.begin(), lines.end());
  vector<int> ans;
  for (int i = 0; i < W; i++) {
    int cur = i + 1;
    for (int j = 0; j < N; j++) {
      if (cur == lines[j].first) {cur = lines[j].second;}
      else if (cur == lines[j].second) {cur = lines[j].first;}
    }
    printf("%d\n", cur);
  }
  return 0;
}

C++: #include <stdio.h>

int main(void) {
	int w,n, a[30][2],i,c,no,rs[5];
	
	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;
}