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>
#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;
	
	int q;
	q = array[x - 1];
	array[x-1] = array[y-1];
	array[y-1] = q;
	

}

void Amidakuji::call(){

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

}

int main(){


	int w, n,loc,a,b,length;
	string text,str_a,str_b,str_v;
	

	while (cin >> w>>n){
		cin.ignore();
		//??????????????????????????§???????????????
		Amidakuji Amidakuji(w);
		for (int i = 0; i < n; i++){
			getline(cin, text);

			length=(int)text.length();
			//????????¶?????§??????10,2??????????????¨??????{1,0,,,2}??????????????¢????????£?????????????????§??????????????????????????????????????????

			//?????????????????????????????????????????????????????§?????????????????£?????????????????\????????????????????£???
			loc=text.find(",", 0);
			str_a = text[0];
			for (int j = 1; j < loc; j++){
				str_v = text[j];
				str_a = str_a + str_v;

			}
			str_b = text[loc + 1];
			for (int j = loc + 2; j < length; j++){
				str_v = text[j];
				str_b = str_b + str_v;
			}

			
			a = stoi(str_a);
			b = stoi(str_b);


			if (a != 0 && b != 0){
				//???????????????????????????swap???????????????
				Amidakuji.Swap(a, b);
				a = b = 0;
			}
		}
	
		//????????????
		Amidakuji.call();
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pb push_back

# define inOut(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
# define RESET(a) memset(a,0,sizeof(a))
# define MEMO(a) memset(a,-1,sizeof(a))
# define DEBUG puts("Debug-Has-Come-Until-Here")


typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	cin.tie(NULL);

	char dummy;
	int T, a,b, arr[35],i,n;
	for (i=1; i<=35; i++) arr[i] = i;
	
	scanf("%d", &n);
	scanf("%d", &T);
	while (T--){
		scanf("%d%c%d", &a,&dummy,&b);
		swap(arr[a], arr[b]);
	}
	for (i=1; i<=n; i++)printf("%d\n", arr[i]);
	
	return 0;
}

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

using hline_t = std::pair<unsigned, unsigned>;

int main(int argc, char const* argv[])
{
	unsigned w, n;
	std::cin >> w >> n ;
	std::vector<hline_t> hlines;
	for (int i = 0; i < n; i++) {
		std::string s;
		hline_t h;
		std::getline(std::cin, s, ',');
		h.first = std::stoi(s);
		std::getline(std::cin, s);
		h.second = std::stoi(s);
		hlines.push_back(h);
	}
	std::vector<unsigned> v(w + 1);
	{
		unsigned n = 0;
		std::generate(v.begin(), v.end(), [&n](){ return n++; });
	}

	for (auto var : hlines) {
		std::swap(v[var.first], v[var.second]);
	}
	std::for_each(v.begin() + 1, v.end(), [&](auto v){ std::cout << v << std::endl; });
	
	return 0;
}

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+1;
  for (int i=0; i<n; i++) {
    string s;
    cin >> s;
    int a = s[0] - '1';
    int b = s[2] - '1';
    swap(ans[a], ans[b]);
  }
  for (int i=0; i<w; i++)
    cout << ans[i] << endl;
}

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

int main(void){
    int w=0, n;
	cin>>w;
	vi x(w);
	for (int i=0; i<w; i++)
		x[i] = i+1;

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

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

C++: #include<iostream>
#include<vector>
 
int main()
{
    int w,n;
 
    char c;
 
    std::cin >> w >> n;
 
    std::vector<int> a(n);
 
    std::vector<int> b(n);
 
    std::vector<int> x(w);
 
    for(int i=0;i<n;++i)
    {
        std::cin >> a[i] >> c >> b[i];
    }
 
    for(int i=0;i<w;++i)
    {
        x[i]=i+1;
    }
 
    for(int i=0;i<n;++i)
    {
        int temp = x[a[i]-1];
 
        x[a[i]-1]=x[b[i]-1];
 
        x[b[i]-1]=temp;
    }
 
    for(int i=0;i<w;++i)
    {
        std::cout << x[i] << '\n';
    }
}

C++: #include<stdio.h>
int main(void){
	int w,n,x,y,temp;
	int a[31];
	char str[7];
	for(int i = 0; i < 31; i++){
		a[i] = i;
	}
	scanf("%d %d",&w,&n);
	for(int i = 0; i < n; i++){
		getline(str);
		if(str[3] == ',')
			str[3] = ' ';
		else
			str[2] = ' ';
		sscanf(str,"%d %d",&x,&y);
		temp = a[x];
		a[x] = a[y];
		a[y] = temp;
	}

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

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.dl", "r", stdin);
	string str = "";
	string res = "";
	int w;
	int n;

	getline (cin, str );
	stringstream ssw(str);
	ssw >> w;

	vector <int> Aj (w, 0);
	int i;
	for (i = 0; i < w; ++i){
		Aj[i] = i;
	} // end for
			
	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	for (i = 0; i < n; ++i){
		getline (cin, str );
		int a,b;
		str = str.replace(str.find(','), 1, " ");

		stringstream ss(str);
		ss >> a >> b;
//		cout << "a: " << a << " b: " << b << endl;
		swap(Aj[a-1], Aj[b-1]);
	} // end for

	for (i = 0; i < w; ++i){
		cout << (Aj[i] + 1) << endl;	
	} // end for
	
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
typedef pair<int,int> p;

int main()
{
	int w,n; cin>>w>>n;
	int ans[w];
	p sticks[n];
	char tmp;
	for(int i=0;i<n;i++)
	{
		cin>>sticks[i].first>>tmp>>sticks[i].second;
	}


	for(int i=0;i<w;i++)
	{
		int now=i+1;
		for(int j=0;j<n;j++)
		{
			if(sticks[j].first==now) now=sticks[j].second;
			else if(sticks[j].second==now) now=sticks[j].first;
		}
		ans[now-1]=i+1;
	}
	for(int i=0;i<w;i++) cout<<ans[i]<<endl;
	return 0;
}

C++: #include<stdio.h>

int w,n;
int a[31];
int x,y;
int k;

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

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

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