Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	lines, _ := strconv.Atoi(sc.Text())
	l := make([]int, lines)
	for i := 0; i < lines; i++ {
		l[i] = i + 1
	}

	sc.Scan()
	rows, _ := strconv.Atoi(sc.Text())
	for i := 0; i < rows; i++ {
		sc.Scan()
		s := strings.Split(sc.Text(), ",")
		a, _ := strconv.Atoi(s[0])
		b, _ := strconv.Atoi(s[1])

		l[a-1], l[b-1] = l[b-1], l[a-1]
	}
	for _, j := range l {
		fmt.Println(j)
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

int a[100];

int main(){
	int w,n;
	cin>>w>>n;
	rep(i,w)a[i]=i+1;
	rep(i,n){
		int x,y;
		scanf("%d,%d",&x,&y);
		int t=a[x-1];
		a[x-1]=a[y-1];
		a[y-1]=t;
	}
	rep(i,w)cout<<a[i]<<endl;
	return 0;
}

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