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 <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define ll (long lon
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main (void){
    
    int tate,bnumber;
    int bridge[31][2] = {0};
    int answer[31] = {0};
    bool roopjudge = true;
    int temp = 0;
    int tempnumber = 0;
    int i,j,k,l;
    
    cin >> tate >> bnumber;
    for(i = 0;i< bnumber;i++)
        scanf("%d%*c%d",&bridge[i][0],&bridge[i][1]);
    /*
    REP(i, bnumber)
    cout << bridge[i][0] << ","<< bridge[i][1] << endl;
    */
    
    for(i = 1; i<=tate; i++)
    {
        temp = i;
        for(k = 0; k<bnumber;k++)
        {
            if(temp == bridge[k][0])
                temp = bridge[k][1];
            else if(temp == bridge[k][1])
                temp = bridge[k][0];
        }
        answer[temp] = i;
    }
    
    REP(i,tate)
    cout << answer[i+1] << endl;
    return 0;
    
}

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

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

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(void)
{
    int w, n;
    cin >> w >> n;
    int m[w];
    for (int i = 0; i < w; i++)
    {
        m[i] = i;
    }
    for (int i = 0; i < n; i++)
    {
        int a, b;
        scanf("%d,%d", &a, &b);
        int t = m[a - 1];
        m[a - 1] = m[b - 1];
        m[b - 1] = t;
    }
    for (int i = 0; i < w; i++)
    {
        cout << m[i] + 1 << endl;
    }
    return 0;
}

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

using namespace std;

int amida[31][31] = { 0 };

int main(){

    int W, n;

    cin >> W;
    for (int vertical = 1; vertical <= W; vertical++){
        amida[vertical][0] = vertical;
    }

    cin >> n;
    for (int horizonal = 1; horizonal <= n; horizonal++){
        int a, b;
        scanf("%d,%d", &a, &b);

        for (int i = 1; i <= W; i++){
            if (i == a){
                amida[i][horizonal] = amida[b][horizonal - 1];
            }
            else if (i==b)
            {
                amida[i][horizonal] = amida[a][horizonal - 1];
            }
            else
            {
                amida[i][horizonal] = amida[i][horizonal - 1];
            }
        }
    }

    for (int i = 1; i <= W;i++){
        cout << amida[i][n] << endl;
    }

    return 0;
}

C++: #include<stdio.h>

int main(void){
	int ans[50],temp;
	int a,b,w,n;

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

C++: #include <iostream>
#include<cstdio>
using namespace std;
int main (){
	int w,N,d[30],sub;
	int a,b;

	cin>>w>>N;
	for(int j=1;j<=w;j++){
		d[j]=j;
	}
	for(int i=0;i<N;i++){
        scanf("%d,%d",&a,&b);
		sub=d[b];
		d[b]=c[a];
		c[a]=sub;
	}
	for(int k=1;k<=w;k++){
	cout<<d[k]<<endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
int w, n;
vector <pair <int, int> > vp;

int main(){
    cin >> w >> n;
    rep(i, n){
        int va, ri;
        scanf("%d, %d", &va, &ri);
        vp.push_back(make_pair(va, ri)); 
    }
    vi ans;
    rep(i, w)ans.push_back(i + 1);
    rep(i, w){
        int out = i + 1;
        rep(j, vp.size()){
            if(out == vp[j].first)out = vp[j].second;
            else if(out == vp[j].second)out = vp[j].first;
        }
        ans[out - 1] = i + 1;
    }
    rep(i, w)cout << ans[i] << endl;
}

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

int main(){
   int W,n,i,z,*num;
   int a[30],b[30];
   char s;
   cin>>W>>n;
   
   num = new int[W];
   for(i=0;i<W;i++) num[i] = i+1;
   
   for(i=0;i<n;i++){
      cin>>a[i]>>s>>b[i];
   }
   for(i=0;i<n;i++){
      z = num[a[i]-1];
      num[a[i]-1] = num[b[i]-1];
      num[b[i]-1] = z;
   }
   for(i=0;i<W;i++){
      printf("%d\n",num[i]);
   }
   delete[] num;
   return 0;
}

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

int main(){
	int w,n,wnum[30];
	for(int i = 0; i < 30; i++){
		wnum[i] = i;
	}
	cin >> w >> n;
	for(int i = 0; i < n; i++){
		int a,b;
		char comma;
		cin >> a >> comma >> b;
		swap(wnum[a],wnum[b]);
	}
	for(int i = 1; i <= w; i++){
		cout << wnum[i] << endl;
	}
	return 0;
}

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

int main(){
	int w, line[100], n, a, b, c;
	char x;

	cin >> w >> n;
	for (int i = 0; i < w; i++){
		line[i] = i + 1;
	}

	for (int i = 0; i < n; i++){
		cin >> a >> x >> b;
		c = line[a-1];
		line[a-1] = line[b-1];
		line[b-1] = c;
	}

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

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	int W, N; scanf(" %d %d", &W, &N);
	vector<int> arr(W+1);
	rep(i,W+1) arr[i] = i;
	rep(i,N) {
		int a, b; scanf(" %d,%d", &a, &b);
		swap(arr[a], arr[b]);
	}
	rep(i,W) printf("%d\n", arr[i+1]);
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(c) (c).begin(),(c).end()
int main(){
	int w,n,t[30];
	scanf("%d%d",&w,&n);
	rep(i,w) t[i]=i;
	rep(i,n){
		string s;
		cin >> s;
		int a=0,b=0,cnt=0;
		for(;s[cnt]!=',';cnt++){
			a*=10;
			a+=(s[cnt]-'0');
		}
		for(cnt++;cnt<s.size();cnt++){
			b*=10;
			b+=(s[cnt]-'0');
		}
		swap(t[a-1],t[b-1]);
	}
	rep(i,w) printf("%d\n",t[i]+1);
	return 0;
}