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 <utility>
using namespace std;

//0011
int main(){
	int w, n;

	int a[30]={0};
	for(int i=0; i<30; ++i){
		a[i] = i+1;
	}

	cin >> w >> n;
	for(int i=0; i<n; ++i){
		pair<int,int> p;
		char comma;
		cin >> p.first >> comma >> p.second;

		//swap		
		int temp = a[p.first-1];
		a[p.first-1] = a[p.second-1];
		a[p.second-1]= temp;
	}

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

C++: #include <iostream>

int main() {
	int w; std::cin >> w;
	int W[w];
	for (int i=0; i<w; i++) W[i] = i+1;
	int n; std::cin >> n;
	int a, b, tmp;
	while (~scanf("%d,%d", &a, &b)) {
		tmp = W[a-1];
		W[a-1] = W[b-1];
		W[b-1] = tmp;
	}
	for (int i=0; i<w; i++) std::cout << W[i] << std::endl;
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int w, s[31], n, a, b;
    cin >> w >> n;
    for(int i=1; i<=w; i++){
        s[i]=i;
    }
    while(n--){
        scanf("%d,%d", &a, &b);
        swap(s[a], s[b]);
    }
    for(int i=1; i<=w; i++){
        cout << s[i] << "\n";
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int w,n;
  cin>>w>>n;
  vi ans(w);
  rep(i,w)ans[i]=i+1;
  rep(i,n){
    int a,b;
    scanf("%d,%d",&a,&b);
    swap(ans[a-1],ans[b-1]);
  }
  rep(i,w)cout<<ans[i]<<endl;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<cstdio>

using namespace::std;

int main(){

	int w;
	int n;
	int i;
	int a;
	int b;
	int number[32] = {};

	scanf("%d", &w);
	scanf("%d", &n);

	for (i = 1; i <= w; i++){
		number[i] = i;
	}

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


	return 0;
}

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

auto main () -> int
{
    int amida [31];
    
    int w;
    std::cin >> w;
    for (auto i = 1; i <= w; ++ i)
    {
        amida [i] = i;
    }

    int n;
    std::cin >> n;
    for (auto i = 0; i < n; ++ i)
    {
        int a , b;
        std::scanf ("%d,%d" , & a , & b);
        std::swap (amida [a] , amida [b]);
    }

    for (auto i = 1; i <= w; ++ i)
    {
        std::cout << amida [i] << std::endl;
    }
}

C++: //↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int main() {
	int a, b, k[35], l[35];
	cin >> a >> b;
	vector<int>ans(a);
	char c;
	for (int i = 0; i < a; ++i) { ans[i] = 1 + i; }
	for (int i = 0; i < b; ++i) { cin >> k[i] >> c >> l[i]; swap(ans[k[i] - 1], ans[l[i] - 1]); }
	for (auto i : ans) { cout << i << endl; }
}

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

void amida(int w, int n, int a[], int b[]);

int main(void){
  int w, n;
  int a[30], b[30];
  char s[20], tmp[10];

  while(cin >> w){
    cin >> n;
    for(int i = 0; i < n; i++){
      cin >> s;
      int j, k;

      for(j = 0; s[j] != ','; j++){
        tmp[j] = s[j];
      }
      tmp[j++] = 0;
      a[i] = atoi(tmp);

      k = 0;
      while(s[j]){
        tmp[k++] = s[j++];
      }
      tmp[k] = 0;
      b[i] = atoi(tmp);
    }

    amida(w, n, a, b);
  }
}

void amida(int w, int n, int a[], int b[]){
  int ans[31];
  int tmp;

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

  for(int i = 0; i < n; i++){
    tmp = ans[a[i]];
    ans[a[i]] = ans[b[i]];
    ans[b[i]] = tmp;
  }

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

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

int main(){
  int w;
  int n;
  vector<int> vertical;
  int a,b;

  cin>>w;

  for(int i=1;i<=w;++i)
    vertical.push_back(i);

  cin>>n;

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

  for(auto i:vertical)
    cout<<i<<endl;

}

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

using namespace std;
 
int main() {
  int w, n;
  cin >> w >> n;
  int ans[n];
 
  for(int i=0;i<=w;i++)
    ans[i] = i;
    
  for(int i=0;i<n;i++) {
  	
    int a, b;
    cin >> a >> b;
    swap(ans[a], ans[b]);
    
  }
  for (int i=1; i<=w;i++)
    cout << ans[i] << "\n";
    return 0;
}

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

using namespace std;

int main(void){
     int w[30];
     int line;
     int n;
     int a1,b1;
     for(int i = 0;i<30;i++){
	  w[i] = i+1;
     }
     cin >> line;
     cin >> n;
//     for(int i=0;i<line;i++){
//	  cout << w[i] << endl;
//     }
//     cout << endl;

     for(int i=0;i<n;i++){
	  scanf("%d,%d",&a1,&b1);
	  int m = w[a1-1];
	  w[a1-1] = w[b1-1];
	  w[b1-1] = m;
//	  for(int i=0;i<line;i++){
//	       cout << w[i] << endl;
//	  }
//	  cout << endl;
     }

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

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

int main(){
	int w,n;
	cin>>w>>n;
	int a[w];
	for(int i=0;i<w;i++) a[i]=i+1;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		int x=s[0]-'1';
		int y=s[2]-'1';
		int z=a[x];
		a[x]=a[y];
		a[y]=z;
	}
	for(int i=0;i<w;i++) cout<<a[i]<<endl;
	return 0;
}

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


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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#define fi first
#define se second
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	int w;
	int n;
	int y;
	char c;
	int a[35],b[35];
	int x[35];
	cin>>w>>n;
	for(int i=1;i<=w;i++) x[i]=i;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>c>>b[i];
	}
	for(int i=1;i<=n;i++){
		y=x[a[i]];
		x[a[i]]=x[b[i]];
		x[b[i]]=y;
	}
	for(int i=1;i<=w;i++){
		cout<<x[i]<<endl;
	}
}