Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}

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

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

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

int main() {
	int w, n, i, x, y, z;
	char str[10], *a, *b;
	cin >> w >> n;
	vector<int> A(w);
	for (i = 0; i < w; i++) A[i] = i + 1;
	for (i = 0; i < n; i++) {
		cin >> str;
		a = strtok(str, ","); 
		x = atoi(a);
		b = strtok(NULL, ","); 
		y = atoi(b);
		z = A[x - 1];
		A[x-1] = A[y-1]; A[y-1] = z;
	}
	for (i = 0; i < w; i++) cout << A[i] << endl;
	return 0;
}

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

pair<int, int> p;
int a[31];

int main()
{
	int w, n, r;
	cin >> w >> n;
	for (int i = 1; i < w + 1; i++)
		a[i] = i;
	for (int i = 0; i < n; i++)
	{
		scanf_s("%d,%d", &p.first, &p.second);
		r = a[p.first];
		a[p.first] = a[p.second];
		a[p.second] = r;
	}
	for (int i = 1; i < w + 1; i++)
	{
		cout << a[i] << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main() {
	int w, n, a, b,c;
	vector<int> s;
	cin >> w >> n;
	for (int j = 1; j <= w; j++) {
		s.push_back(j);
	}
	for (int i = 0; i < n; i++) {
		(cin >> a).ignore() >> b;
		c = s[a - 1];
		s[a - 1] = s[b - 1];
		s[b - 1] = c;
	}
	for (int k = 0; k < w; k++) {
		cout << s[k] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	int n , w , i , j , a , b;
	int number[40] ;
	cin >> w ;
	cin >> n;
	for( i=1 ; i<=n ; i++ ){
		scanf( "%d,%d" , &a , &b );
		int x = number[a];
		number[a] = number[b];
		number[b] = x ;
	}
	for( i=1 ; i<=w ; i++ )
		cout << number[i] << endl;
}

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

class Amidakuji{

public:
	int W;
	vector<int> array;//????´?1???????????????
	Amidakuji(int w);
	void Swap(int x,int y);
	void call();
};

//????????????????????????????????????
Amidakuji::Amidakuji(int w){

	for (int i = 0; i < w; i++){
		array.push_back(i+1);//[0,1,2,3,4]={1,2,3,4,5}
	}
	
	W = w;

}

void Amidakuji::Swap(int x,int y){

	//???????????£????????????array[]???????????????
	//int?????§???????????£????????§char???int?????????????????????-48;
	x -= 48;
	y -= 48;
	int q;
	q = array[x - 1];
	array[x-1] = array[y-1];
	array[y-1] = q;
	for (int i = 0;i<W; i++){
		cout << array[i];
	}cout << endl;


}

void Amidakuji::call(){

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

}

int main(){

	int w, n;
	string text;

	while (cin >> w>>n){
		cin.ignore();
		//??????????????????????????§???????????????
		Amidakuji Amidakuji(w);
		for (int i = 0; i < n; i++){
			cout << i<<endl;
			getline(cin, text);
			if (text[0] != 0 && text[2] != 0){
				//???????????????????????????swap???????????????
				Amidakuji.Swap(text[0], text[2]);
				text[0] = text[2] = 0;
			}
		}
	
		//????????????
		Amidakuji.call();
	}


	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#define N 30
using namespace std;
int main(){
  int w,n,tmp;
  int lod[N]; int lis[N][3];
  while(cin >> n >> w){
  for(int i = 0;i<n;i++){
    lod[i] = i+1;
  }

  for(int i=0;i<w;i++){
    scanf("%d,%d",&lis[i][0],&lis[i][2]);
  }
  for(int i=0;i<w;i++){
    tmp = lod[lis[i][0]-1];
    lod[lis[i][0]-1] = lod[lis[i][2]-1];
    lod[lis[i][2]-1] = tmp;
  }
  for(int i=0;i<n;i++){
    cout << lod[i] << endl;
  }
  }
}

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

int main(void){
  int s[30];
  int w,n;

  for(int i = 0;i<30;i++) s[i] = i;

  cin >> w;
  cin >> n;

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

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

  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main() {
	int num,a=0,b=0,draw;
	cin >> num;
	int *line = new int[num];
	for (int w = 0; w < num; w++) {
		line[w] = w + 1;
	}
		cin >> draw;
		for (int w = 0; w < draw; w++) {
			scanf("%d,%d", &a, &b);
			swap(line[a-1], line[b-1]);
		}
		for (int w = 0; w < num; w++) {
			cout<<line[w]<<endl;
		}
	return 0;
}

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

using namespace std;

int main(void){
  char c;
  int w, n, a, b;
  vector<int> v;
  vector<pair<int, int> > p;

  cin >> w;
  cin >> n;
  for(int i=1; i<=w; i++){
    v.push_back(i);
  }

  for(int i=0; i<n; i++){
    cin >> a >> c >> b;
    p.push_back(make_pair(a, b));
  }

  for(int i=0; i<n; i++){
    swap(v[p[i].first-1], v[p[i].second-1]);
  }

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

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

using namespace std;

int main(void) {
	int w, n, a, b;
	int i;
	int out[31], tmp;

	cin >> w;
	cin >> n;

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

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

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

	return 0;
}

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

int main() {
  string str;
  char ch;
  int w, n, a, b;
  cin >> w >> n;
  vector<int> num(w, 0);
  for(int i = 0; i < w; i++) num.at(i) = i + 1;
  
  for(int i = 0; i < n; i++){
    cin >> a >> ch >> b;
    swap( num.at(a - 1), num.at(b - 1));
  }
  
  for(int i = 0; i < w; i++) cout << num.at(i) << endl;
}

C++: #include<stdio.h>

int main(){
	int tate,yoko,bou[40][2],j,x,kekka[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30},i=0;
	scanf("%d %d",&tate,&yoko);
	for(j=0;j<yoko;j++){
		scanf("%d",&bou[j][1]);
		printf(",");
		scanf("%d",&bou[j][2]);
	}
	for(i=1;i<tate+1;i++){
		x=i;
		for(j=0;j<yoko;j++){
			if(bou[j][1]==x){
				x=bou[j][2];
			}
			else if(bou[j][2]==x){
				x=bou[j][1];
			}
		}
		kekka[x-1]=i;
	}
	for(j=0;j<tate;j++){
		printf("%d\n",kekka[j]);
	}
}

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

using namespace std;

int main(){

	int n , w;
	int a , b , ary[100];

	cin >> w >> n;

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

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

		int tmp = ary[a];
		ary[a] = ary[b];
		ary[b] = tmp;
	}

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

	return 0;
}

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

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