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

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

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

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

C++: #include <stdio.h>

int main() {
	int w, n;
	int a[30][2];
	int ans[30];

	int i;

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

	for(i = 0; i < n; i++)
		scanf("%d,%d", &a[i][0], &a[i][1]);

	for(i = 0; i < w; i++)
		ans[i] = i + 1;
	
	for(i = 0; i < n; i++) {
		int temp;

		temp = ans[a[i][0] - 1];
		ans[a[i][0] - 1] = ans[a[i][1] - 1];
		ans[a[i][1] - 1] = temp;
	}

	for(i = 0; i < w; i++)
		printf("%d\n", ans[i]);

	return 0;
}

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

using namespace std;

int main() {
    int w, n;
    cin >> w >> n;

    vector<int> v(w);
    iota(v.begin(), v.end(), 1);

    int a, b;
    char c;
    for (int i=0; i<n; ++i) {
        cin >> a >> c >> b;
        swap(v[a - 1], v[b - 1]);
    }

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

    return 0;
}

C++: 


#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	int n, m;
	int ver[31];
	scanf("%d", &n);
	scanf("%d", &m);
	for (int i = 0; i < n; i++) {
		ver[i] = i + 1;
	}
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d,%d", &x, &y);
		swap(ver[x-1], ver[y-1]);
	}
	for (int i = 0; i < n; i++) {
		printf("%d\n", ver[i]);
	}
	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

void out1(vector<int> a) {
	for (size_t i = 0; i < a.size(); i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}

int main() {
	int w, n;
	cin >> w;	// ???????????°
	cin >> n;	// ?¨?????????°
	vector<int> begin(n);
	vector<int> end(n);
	vector<int> location(w);
	int num1 = 0;
	int num2 = 0;

	// ??\???
	for (size_t i = 0; i < n; i++)
	{
		scanf_s("%d,%d", &begin[i], &end[i]);
		cout << begin[i] << end[i] << endl;
	}

	// location????????????
	for (size_t i = 0; i < w; i++)
	{
		location[i] = i + 1;
		
	}
	
	// ????????\??¬????????§????????????
	for (size_t i = 0; i < w; i++)
	{
		vector<int> tmp(w,0);
		out1(tmp);
		tmp[i] = location[i];
		cout << "----i = " << i << "?????¨???----" << endl;
		for (size_t j = 0; j < n; j++)
		{
			if (begin[j] == location[i])
			{
				
				cout << begin[j] << "???" << end[j] << "?????\???????????????" << endl;
				location[i] = end[j];
			}
			else if (end[j] == location[i])
			{
				cout << end[j] << "???" << begin[j] << "?????\???????????????" << endl;
				location[i] = begin[j];
			}
			out1(location);
		}
	}
	// ???????????????
	vector<int> output(w,0);
	for (size_t i = 0; i < w; i++)
	{
		output[location[i]-1] = i;
	}

	// ???????????¨???????????????????????°??????1????¶????
	for (size_t i = 0; i < w; i++)
	{
		cout << output[i]+1 << endl;
	}


	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
std::vector<int> change (std::vector<int> v,int i, int j) {
	int tmp = v[i-1];
	v[i-1] = v[j-1];
	v[j-1] = tmp;
	return v;
}
int main () {
	int w,n;
	cin >> w >> n;
	std::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;
		scanf("%d,%d",&a,&b);
		num = change(num,a,b);
	}
	for(int i = 0; i < w; i++) {
		cout << num[i]<< endl;
	}
}

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

int main(){
	int a[30];
	int b[30];
	int n,m;

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


	for(int i = 0; i < m; i++){
		swap(c[a[i] - 1], c[b[i] - 1]);
	}

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



}

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

int main(){
	const int MAX_w = 30;
	int w, n, a, b, c, p;
	int lots[MAX_w + 1];
	string str;
	
	for(int i = 1; i <= MAX_w; i++){
		lots[i] = i;
	}
	
	cin >> w >> n;
	
	for(int i = 0; i < n; i++){
		a = 0; b = 0;
		cin >> str;
		
		p = 0;
		while(str[p] != ','){
			a = a * 10 + (str[p] - 48);
			p++;
		}
		p++;
		while(p < str.size()){
			b = b * 10 + (str[p] - 48);
			p++;
		}
		
		c = lots[a];
		lots[a] = lots[b];
		lots[b] = c;
	}
	
	for(int i = 1; i <= w; i++){
		cout << lots[i] << endl;
	}
	
	return 0;
}

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

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

int main()
{
  int w,n;
  int c[]={0};
  int a,b;
  //  int temp;

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

  for(int i=0; i<=n; i++){
    c[i]=i;
  }

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

  for(int i=1; i<=w; i++){
    printf("%d\n",c[i]);
  }
}

C++: 
w = input()
n = input()
k = []
for i in range(w+1):
    k.append(i)
for i in range(n):
    l = raw_input()
    a = int(l[0])
    b = int(l[2])
    temp = k[a]
    k[a] = k[b]
    k[b] = temp

for i in range(w):
    print k[i+1]

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

int main(){
  int a,b,m[31],c,e;
  string d;
  cin >>a>>b;
  for(int i=1;i<=a;i++)m[i]=i;
  for(int i=1;i<=b;i++){
    cin >>d;
    swap(m[d[0]-'0'],m[d[2]-'0']);
  }
  for(int i=1;i<=a;i++)cout<<m[i]<<endl;
  return 0;
}

C++: #include <cstdio>
 #include <algorithm>
 
 int main(){
 	int array[50];
 	int w,n,a,b;
 
 	for(int i=0 ; i<50 ; i++){
 		array[i] = i;
 	}
 	
 	scanf("%d", &w);
 	scanf("%d", &n);
 	for(int i=0 ; i<n ; i++){
 		scanf("%d,%d", &a, &b);
 		swap( array[a] , array[b] );
 	}
 	for(int i=1 ; i<=w ; i++){
 		printf("%d\n", array[i]);
 	}
 }