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

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

using namespace std;

int main() {
  int w,n;

  cin >> w >> n;

  vector<int> line(w);
  for(int i = 0; i < w; i++) {
    line[i]=i;
  }
  int t = 0;
  while(t < n) {
    int a,b;
    char c;
    cin >> a >> c  >> b;
    line[a-1] ^= line[b-1];
    line[b-1] ^= line[a-1];
    line[a-1] ^= line[b-1];
    
    t++;
  }

  for(auto l : line)
    cout << l+1 << endl;
  
  return 0;
}

C++: #include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)

typedef pair<int, int> P;

int dp[60];

int main()
{
	int w(0),n(0);
	REP(i, 60){
		dp[i] = i;
	}
	cin >> n >> w;
	REP(i, w){
		int a, b;
		char c;
		scanf("%d,%d", &a,&b);
		swap(dp[a], dp[b]);
	}
	REP(i, n){
		cout << dp[i+1] << endl;
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(inti =a; i<n; i++)
using namespace std;
 
int main() {
int w,n; cin >> w >> n;
int a[31];
rep(i,0,w) a[i] = i+1;
 
rep(i,0,n) {
int x,y;
scanf("%d,%d",&x,&y);
swap(a[x-1],a[y-1]);
}
rep(i,0,n) cout << a[i] << endl;
return 0;
}

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

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

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;
        char c;
        scanf("%d%c%d",&a,&c,&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<iostream>
#include<cstdio>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  int w, n, a[40][2], pos[40];
  cin >> w >> n;
  rep (i, n) scanf("%d,%d", a[i], a[i] + 1);
  rep (i, n) --a[i][0], --a[i][1];
  rep (i, w) pos[i] = i;
  rep (i, n) swap(pos[a[i][0]], pos[a[i][1]]);
  rep (i, w) cout << pos[i] + 1 << endl;
  return 0;
}