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])
	}
}

Python: def main():
    n = int(input())
    point = int(input())
    A = []
    for i in range(n):
        A.append(i+1)
    for i in range(point):
        a,b = map(int,input().split(","))
        A[a-1],A[b-1] = A[b-1],A[a-1]
    for value in A:
        print(value)
      


if __name__ == '__main__':
    main()

Python: a=[int(i+1) for i in range(int(input()))]
for i in range(int(input())):
    b,c=map(int,input().split(','))
    a[b-1],a[c-1]=a[c-1],a[b-1]
for i in a:print(i)

Python: import  math
tate =int(input())
yoko=int(input())
arr = [i+1 for i in range(tate)]
for j in range(yoko):
    rep1,rep2=input().split()
    rep1=int(rep1)-1
    rep2=int(rep2)-1
    arr[rep1],arr[rep2] = arr[rep2],arr[rep1]

for k in range(tate):
    print(arr[k])

Python: w = list(range(1,int(raw_input())+1))
for i in range(int(raw_input())):
	a,b = map(int,raw_input().split(','))
	w[a-1], w[b-1] = w[b-1], w[a-1]
print('\n'.join(map(str,w)))

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

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

C++: /*AOJ 0011*/

#include<iostream>
#include<vector>

using namespace std;

int main(){
	int w,n;

	cin>>w;
	cin>>n;

	vector<int> a;
	vector<int> b;

	int ans[30];

	for(int i=0;i<n;i++){
		int tmp1,tmp2;
		cin>>tmp1;
		cin>>tmp2;
		a.push_back(tmp1-1);
		b.push_back(tmp2-1);
	}
	/*
	for(int i=0;i<n;i++){
		cout<<a[i]<<" "<<b[i]<<endl;
	}
	*/

	for(int i=0;i<w;i++){
		int point = i;

		for(int j=0;j<n;j++){
			if(point==a[j]){
				point = b[j];
			}
			else if(point==b[j]){
				point = a[j];
			}
		}
		ans[point] = i+1;
	}

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

	return 0;
}

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

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

    vector<int> ans;
    for(int i = 0 ; i <= w ; ++i){
        ans.emplace_back(i);
    }

    for(int i = 0 ; i < n ; ++i){
        int a, b;
        char c;
        cin >> a >> c >> b;
        swap(ans[a], ans[b]);
    }

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

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
long gcd(long n,long m){
	if (m == 0) return n;
	return gcd(m, n % m);
}

long lcm(long n, long m) {
	return m / gcd(n, m)*n;
}

int main(void) {
	int w, n, a, b, tmp;
	int ans[30];
	for (int i = 0; i < 30; i++)
		ans[i] = i + 1;
	scanf("%d\n%d", &w, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d,%d", &a, &b);
		tmp = ans[a - 1];
		ans[a - 1] = ans[b - 1];
		ans[b - 1] = tmp;
	}
	for (int i = 0; i < w; i++)
		cout << ans[i] << endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

	for(int i=0;i<n;i++){
		int a1,b1;
		char dummy;
		cin>>a1>>dummy>>b1;
		a1--;b1--;
		int tmp=nums[b1];
		nums[b1]=nums[a1];
		nums[a1]=tmp;
	}

	for(int i=0;i<w;i++){
		cout<<nums[i]<<"\n";
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

int main(int argc, char **argv)
{
  int w, n, a, b;
  char c;
  vi v;

  cin >> w;
  rep (i, w + 1) {
    v.pb(i);
  }

  cin >> n;
  while (n--) {
    cin >> a >> c >> b;
    swap(v[a], v[b]);
  }
  repab (i, 1, w + 1) {
    cout << v[i] << endl;
  }

  return 0;
}

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

using namespace std;

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

	vector<int> lines;
	for(int i = 1; i <= w; i++)
		lines.push_back(i);

	int n;
	cin >> n;

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

	for(auto line : lines)
		cout << line << endl;

	return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int main(){
	int w, n;
	cin >> w >> n;
	int s[w];

	for(int i=0; i<w; i++){
		s[i] = i+1;
		while(n--){
		int a, b, c;
		cin >> a >> b;

		int tmp = s[a-1];
		s[a-1] = s[b-1];
		s[b-1] = tmp;
	}

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

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

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int i, temp;
  int w, n, ai, bi;

  cin >> w;
  cin >> n;

  vector<int> amida;

  // initialize
  for (i = 0; i < w; i++) {
    amida.push_back(i + 1);
  }

  for (i = 0; i < n; i++) {
    scanf("%d,%d", &ai, &bi);

    // swap
    temp = amida.at(ai - 1);
    amida.at(ai - 1) = amida.at(bi - 1);
    amida.at(bi - 1) = temp;
  }

  for (i = 0; i < w; i++) {
    cout << amida.at(i) << endl;
  }

  return 0;
}

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

int main(){
int a,b,c[60],d[30];
cin >> a;cin >> b;
for(int i = 0;i <= (b - 1);i++){
	scanf("%d,%d",&c[2 * i],&c[2 * i + 1]);
}
for(int e = 1;e <= a;e++){
	d[e - 1] = e;
}
for(int f = 0;f <= b - 1;f++){
	swap(d[c[2 * f] - 1],d[c[2 * f + 1] - 1]);
}
for(int g = 0;g <= a - 1;g++){
	cout << d[g] << endl;
}
fflush(stdin);
getchar();


return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main(){
    int w, n;
    int d[31];
    while(cin >> w >> n){
        for(int i=1;i<=w;i++) d[i] = i;
        for(int i=0;i<n;i++){
            string s; cin >> s;
            for(int j=0;j<s.size();j++)
                if(s[j]==',') s[j] = ' ';
            istringstream iss(s);
            int a, b; iss >> a >> b;
            swap(d[a], d[b]);
        }
        for(int i=1;i<=w;i++) cout << d[i] << endl;
    }
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int w,n;
	int a,b;

	cin >> w >> n;

	int h[w];

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

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