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<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int maxw=30+5;
int w,n,rank[maxw];
int main(){
    scanf("%d%d",&w,&n);
    for(int i=1;i<=w;i++)
        rank[i]=i;
    for(int i=1,x,y;i<=n;i++){
        scanf("%d,%d",&x,&y);
        swap(rank[x],rank[y]);
    }
    for(int i=1;i<=w;i++)
        cout<<rank[i]<<endl;
    return 0;
}

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

int main(){
	int n, m;
	cin >> n >> m;
	int a[n];
	for(int i = 0; i < n; i++){
		a[i] = i+1;
	}
	for(int i = 0; i < m; i++){
		stringstream ss1, ss2;
		string str;
		int p, q;
		cin >> str;
		ss1 << str[0];
		ss2 << str[2];
		ss1 >> p;
		ss2 >> q;
		swap(a[p-1],a[q-1]);
		
	}
	for(int i = 0; i < n; i++){
		cout << a[i] << endl;
	}
}

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

int main() {
	int w, n;
	string str;
	cin >> w >> n;
	int ami[30];
	for (int i = 0; i < w; i++) {
		ami[i] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		int a, b, temp;
		string str;
		cin >> a >> b;
		temp = ami[a-1];
		ami[a-1] = ami[b-1];
		ami[b-1] = temp;
	}
	for (int i = 0; i < w; i++) {
	cout << ami[i] <<endl;
	}

	return 0;
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

int num[31];

int main(){
    rep(i,31)num[i]=i;
    int x,y;
    cin>>x>>y;
    
    int n,m;
    char b;
    rep(i,y){
        cin>>n>>b>>m;
        swap(num[n],num[m]);
    }
    for(int i=1;i<x+1;i++){
        cout<<num[i]<<endl;
    }
    return 0;
}

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

int main(){
	
	int w,n;
	char con;
	cin>>w>>n;
	vector<int> s(w);
	vector<int> a(n);
	vector<int> b(n);
	
	for(int i=0;i<w;i++)
		s[i]=i+1;
	
	for(int i=0;i<n;i++)
		cin>>a[i]>>con>>b[i];
	
	for(int i=0;i<n;i++)
		swap(s[a[i]-1],s[b[i]-1]);
	
	for(int i=0;i<w;i++)
		cout<<s[i]<<endl;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int w, n, ans[31];
	cin >> w >> n;
	for (int i = 0; i <= 30; i++)
		ans[i] = 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 <= 30; i++)
		cout << ans[i] << endl;
}

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

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

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;
            istringstream iss >> s;
            for(int j=0;j<s.size();j++)
                if(s[j]==',') s[j] = ' ';
            int a, b; iss >> a >> b;
            swap(d[a], d[b]);
        }
        for(int i=1;i<=w;i++) cout << d[i] << endl;
    }
}

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

vector<int> ans(31);

void swap(int a, int b){
  int tmp = ans[a];
  ans[a] = ans[b];
  ans[b] = tmp;
}

int main(){
  int w, n;

  cin >> w >> n;
  for(int i=1; i<=w; i++) ans[i] = i;

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

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

C++: #include<iostream>
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

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

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

using namespace std;

int nums[100];
int main() {
  int w, n;
  scanf("%d %d", &w, &n);
  for (int i = 1; i <= w; i++) {
    nums[i] = i;
  }
  while (n--) {
    int a,b;
    scanf("%d,%d", &a, &b);
    swap(nums[a], nums[b]);
  }
  for (int i = 1; i <= w; i++) {
    printf("%d\n", nums[i]);
  }
}

C++: // 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++)
int main()
{
	int w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	int a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		string d[2];
		roop(i, s.length) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		int swap[2];
		roop(i, 2) {
			swap[i] = stoi(d[i]);
		}
		int before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}

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

int main(){

	int w, n;
	int num[30] = { 0 };
	int a, b;
	char c

	cin >> w;
	cin >> n;

	for (int i = 0; i<w; i++)
		num[i] = i + 1;

	for (int i = 0; i<n; i++){

		cin >> a >> c >> b;


		int tmp = num[a-1];
		num[a-1] = num[b-1];
		num[b-1] = tmp;


	}


	for (int i = 0; i<w; i++)
		cout << num[i] << "\n";

	return 0;

}

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

int main() {
  int w, n, a, b;
  char d;
  cin >> w >> n;
  vector<int> v(w + 1);
  for (int i = 0; i <= w; i++) {
    v[i] = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> a >> d >> b;
    int t = v[a];
    v[a] = v[b];
    v[b] = t;
  }
  for (int i = 1; i <= w; i++) {
    cout << v[i] << endl;
  }
  return 0;
}

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

inline void Swap(int* a, int* b)
{
	int temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

int main(void)
{
	int w, n, A[31] = {};
	char op;
	cin >> w;
	for(int i = 0; i < w; i++)
		A[i] = i+1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> op >> b;
		Swap(&A[a - 1], &A[b - 1]);
	}
	for (int i = 0; i < w; i++)
		cout << A[i] << endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
  
int main()
{
    int w, n;
    cin >> w >> n;
    vector<int> num(w);
    for(int i=0; i<w; ++i)
        num[i] = i+1;
  
    for(int i=0; i<n; ++i){
        int a, b;
        char c;
        cin >> a >> c >> b;
        swap(num[a-1], num[b-1]);
    }
  
    for(int i=0; i<w; ++i)
        cout << num[i] << endl;
  
    return 0;
}