Go: package main

import "fmt"

func main() {
	var w, n, a, b, i, te int
	var amida [31]int
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)
	for i := 1; i <= w; i++ {
		amida[i] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d,%d", &a, &b)
		te = amida[a]
		amida[a] = amida[b]
		amida[b] = te
	}
	for i := i; i <= w; i++ {
		fmt.Printf("%d\n", amida[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;
}

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++:  /*
Let's play Amidakuji.

In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
	
						[picture]
	
In the starting points (top of the figure), numbers are assigned to vertical lines in ascending order from left to right. At the first step, 2 and 4 are swaped by the first horizontal line which connects second and fourth vertical lines (we call this operation (2, 4)). Likewise, we perform (3, 5), (1, 2) and (3, 4), then obtain "4 1 2 5 3" in the bottom.

Your task is to write a program which reads the number of vertical lines w and configurations of horizontal lines and prints the final state of the Amidakuji. In the starting pints, numbers 1, 2, 3, ..., w are assigne to the vertical lines from left to right.
 */
 
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

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

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

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[5];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[len];
    for(int i = 0; i < len; i++){
        array[i] = i+1;
    }
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

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

using namespace std;

int horizontalLine,verticalLine;
int A,B;
char UserInput[10];

int main()
{
        cin >> verticalLine;
        cin >> horizontalLine;

        int NumberExist[verticalLine];
        for(int y = 1; y <= verticalLine; y++)
        {
            NumberExist[y-1] = y;
        }

        for(int x = 1; x <= horizontalLine; x++)
        {
            cin >> UserInput;
            A = UserInput[0] - '0';
            B = UserInput[2] - '0';
            int TempVariable;
            TempVariable = NumberExist[A-1];
            NumberExist[A-1] = NumberExist[B-1];
            NumberExist[B-1] = TempVariable;

        }

        for(int z = 0; z < verticalLine; z++)
        {
            cout << NumberExist[z] << endl;
        }


}