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>

using namespace std;

int main() {
	int w, n;
	cin >> w;
	cin >> n;
	int *array = new int[w + 1];
	for (int i = 1; i < w + 1; i++) {
		array[i] = i;
	}
	for (int i = 1; i < n+1; i++) {
		int a, b;
		char c;
		cin >> a >> c >> b;
		int tmp;
		tmp = array[a];
		array[a] = array[b];
		array[b] = tmp;
	}
	for (int i = 1; i < w + 1; i++) {
		cout << array[i] << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<sstream>
using namespace std;

	int stoi(string a){
		int b;
		stringstream ss;
		ss<<a;
		ss>>b;
		return b;
	}
	string itos(int a){
		stringstream ss;
		ss >>a;
		string b;
		b=ss.str();
		return b;
	}

int main(){
	int w,n,ans[40]={0};
	cin>>w>>n;
	for(int i=0;i<40;i++)ans[i]=i+1;
	for(int i=0;i<n;i++){
		string a,maes,usis;int kan,mae,usiro;
		cin>>a;
		kan=a.find(',');
		maes=a.substr(0,kan);
		usis=a.substr(kan+1,a.size()-kan);
		mae=stoi(maes);
		usiro=stoi(usis);
		swap(ans[mae-1],ans[usiro-1]);
	}
	for(int i=0;i<w;i++)cout<<ans[i]<<endl;
    return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

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


int main(){
	ios::sync_with_stdio(false);

	int w, n;
	int a, b;
	char s;

	cin >> w;
	cin >> n;

	vi bar(w);

	REP(i, w)
		bar[i] = i + 1;

	while (n!=0){
		cin >> a >> s >> b;



		swap(bar[a - 1], bar[b - 1]);
		n--;
	}

	REP(i, w)
		printf("%d\n", bar[i]);
}

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

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[len];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[len];
    for(int i = 0; i < len; i++){
        array[i] = i+1;
    }
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

C++: w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]

C++: #include<iostream>
int main(){
	int w,n,a[30][2],b[30];
	std::cin>>w
		>>n;
	for(int i=0;i<n;++i){
			std::cin>>a[i][0]>>','>>a[i][1];
	}
	for(int i=1;i<=w;++i){
		b[i]=i;
	}
	for(int i=0;i<n;++i){
			int x=b[a[i][0]];
			b[a[i][0]]=b[a[i][1]];
			b[a[i][1]]=x;
	}
	for(int i=1;i<=w;++i){
		std::cout<<b[i]<<std::endl;
	}
	return 0;
}

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

int main()
{
	int tmp[30][2];
	int num[30];
	int num2[30];
	int w,n,i,j;
	
	//??????????????????
	for(j=0; j<2; j++){
		for(i=0; i<30; i++){
			tmp[i][j]=0;
			}
	}
	for(i=0; i<30; i++){
		num[i]=1+i;
		num2[i]=1+i;
	}
	
	//????£?w????¨??£?n?????°?????????
	cin >> w >> n;
	
	//?¨??£????????´??????????
	for(i=0; i<n; i++){
		scanf("%d,%d",&tmp[i][0],&tmp[i][1]);
	}
	
	//??\???????????????
	for(i=0; i<w; i++){		//????£??????°????????°?????????
		for(j=0; j<n; j++){		//?¨??£??????°????????°?????????
			//??\?????????
			if((num[i]==tmp[j][0]) || (num[i]==tmp[j][1])){
				if(num[i]==tmp[j][0]){
					num[i]=tmp[j][1];
				}else{
					num[i]=tmp[j][0];
				}		
			}
		}
	}
	for(i=0; i<w; i++){
		j=num[i];
		num2[j-1]=i+1;
	}
	
	
	
	
	//????????¨???
	for(i=0; i<w; i++){
		cout << num2[i] << endl;
	}
	
	return 0;
}

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

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

C++: #include <cstdio>
using namespace std;
int w, n, a[31], f, s, t;
int main() {
  for (int i = 0; i < 31; i++) {
    a[i] = i;
  }
  scanf("%d%d", &w, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d,%d", &f, &s);
    t = a[f];
    a[f] = a[s];
    a[s] = t;
  }
  for (int i = 1; i <= w; i++) {
    printf("%d\n", a[i]);
  }
}

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


void swap(int,int);
int ladder[50];
string change;

int main(){
	int v,h,a,b;
	cin >> v >> h;
	for(int i=1;i<=v;i++){
		ladder[i]= i;
	}
	for(int i=1;i<=h;i++){
		cin >> change;
		//cout << change[2];
		change.replace(change.find(","),1," ");
		//tmp.replace(tmp.find(","),1," ");
		istringstream ss(change);
		ss >> a >> b;

		//temp = ladder[b];
		//ladder[b] = ladder[a];
		//ladder[a] = temp;
//		cout << ladder[a] << ladder[b] << endl;
	//	cout << endl << endl;
		swap(a,b);
		/*for(int i=1;i<=v;i++){
			cout << ladder[i] << endl;
		}
		cout << endl;*/
		//	cout << ladder[change[0]] << "-"<<ladder[change[2]] << endl;
	}
//	cout <<endl;

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

void swap(int a,int b){
	int temp;
	temp = ladder[b];
	ladder[b] = ladder[a];
	ladder[a] = temp;
	/*cout << ladder[a] << ladder[b] << endl;
	cout << endl << endl;*/
}

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

int main(){
vector<int>v;
int w,n;
int a,b;
cin>>w>>n;
for(int i=0;i<w;i++){
	v.push_back(i+1);
	}
	
	for(int i=0;i<n;i++){
		scanf("%d","%d",&a,&b);
		int c=v[a];
		v[a]=v[b];
		v[b]=c;
		}
		
		for(int i=0;i<w;i++){
			cout<<v[i]<<endl;
			}
			
		return 0;
		
		}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;


int main(void){

	int w, n;
	int left[30] = {}, right[30] = {};
	int ans[30] = {};
	scanf("%d%d", &w, &n );
	for( int i = 0; i < n; i++ ) {
		scanf("%d,%d", left + i, right + i);
		left[i] --;
		right[i] --;
	}
	for( int i = 0; i < w; i++ ) {
		int tmp = i;
		for( int j = 0; j < n; j++ ) {
			if( tmp == left[j] )
				tmp = right[j];
			else if( tmp == right[j] )
				tmp = left[j];
		}
		ans[tmp] = i + 1;
	}
	for( int i = 0; i < w; i++ )
		cout << ans[i] << endl;


    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int w, n, a, b, num[31], store;
    
    cin >> w;
    cin >> n;
    
    for(int i = 1; i <= w; i++){
        num[i] = i;
    }
    
    for(int i = 1; i <= n; i++){
        scanf("%d, %d", &a, &b);
        swap(num[a], num[b]);
    }
    for(int i = 1; i <= w; i++){
        cout << num[i] << endl;
    }
}