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
//-------------
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <numeric>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef  long long LL;
typedef  vector<int> VI;
typedef  vector<string> VS;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(x) REP(i,SZ(x))cerr<<i<<x<<"="<<x[i]<<endl;
#define SIZE(x) cout<<sizeof(x)<<endl;
const int MOD = 1000000007;
//-------------
//cout
//-------------
#define COUTL(x) cout<<x<<endl
#define COUT(x) cout<<x
//-------------
//??£?¨??????\
//-------------
#define INTIN(x) int x; cin>>x;
#define INTINTIN(x,y) int x,y; cin>>x>>y;
#define STRIN(x) string x; cin>>x;
int main()
{
	VI amida;
	int w,n;
	cin >> w >> n;
	REP(i,w)
	{
		amida.push_back(i+1);
	}
	REP(i, n)
	{
		string temp;
		cin >> temp;
		int x = temp[0] - 48;
		int y = temp[2] - 48;
		int test;
		test = amida[x-1];
		amida[x - 1] = amida[y - 1];
		amida[y - 1] = test;
	}
	REP(i, w)
	{
		if (i == w-1)
		{
			COUT(amida[i]);
		}
		else
		{
			COUTL(amida[i]);
		}
	}
	#ifdef _DEBUG
	while(1);
#endif
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <numeric>
#include <string>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
    int W,N;
	cin >> W >> N;

	vector<int> ret(W);
    iota(begin(ret),end(ret),1);

    REP(i, N){
    	int a,b;
    	string str;
    	getline(cin,str,',');
    	a = stoi(str);

    	getline(cin,str,'\n');
    	b = stoi(str);

    	int buf = ret[a-1];
    	ret[a-1] = ret[b-1];
    	ret[b-1] = buf;
    }
    REP(i, W) cout << ret[i] << endl;
    return 0;
}

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

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

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

C++: #include<iostream>
int main(void){
	int w,n,x,y,temp;
	int a[31];
	char c;
	string str;
	istringstream is(str);
	for(int i = 0; i < 31; i++){
		a[i] = i;
	}
	scanf("%d %d",&w,&n);
	for(int i = 0; i < n; i++){
		getline(str,7);
		is >> x >> c >> y;
		temp = a[x];
		a[x] = a[y];
		a[y] = temp;
	}

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

C++: #include <iostream>
using namespace std;
int main() {
    int line;
    int side;
    int sidenum1,sidenum2;
    int linenum[line];
    char waste;
    cin>>line>>side;
    for(int i=0; i<line; i++){
        linenum[i]=i+1;
    }
    for(int i=0; i<side; i++){
        cin>>sidenum1>>waste>>sidenum2;
        swap(linenum[sidenum1-1],linenum[sidenum2-1]);
    }
    for(int i=0; i<line; i++){
        cout<<linenum[i]<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>
#include <chrono>

using namespace std;

class amida
{
	int w;
	vector<int> va;
public:
	amida(int _w) : w(_w){
		for(int i = 0; i < w; i++){
			va.push_back(i);
		}
	}
	void swap(int, int);
	void output();
};

void amida::swap(int a1, int b1)
{
	int temp = va[a1-1];
	va[a1-1] = va[b1-1];
	va[b1-1] = temp;
}

void amida::output()
{
	for(int i = 0; i < w; i++)
		cout << va[i]+1 << '\n';
}

int main()
{
	int w, n;
	int a1, b1;
	cin >> w;
	amida am(w);
	cin >> n;
	for(int i = 0; i < n; i++){
		string str;
		cin >> str;
		const char* chtemp = str.c_str();
		char *ct;
		a1 = atoi(strtok_s((char*)chtemp, ",", &ct));
		b1 = atoi(strtok_s(NULL, ",", &ct));
		am.swap(a1, b1);
	}
	am.output();

	return 0;
}

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

int main()
{
	int w,n,i;
	cin >> w; cin >> n;
	int vertical_bar[w];
	// 配列を初期化
	for(i=0;i<w;i++){
		vertical_bar[i] = i+1;
	}
		
	for(i=0;i<n;i++){
		int a,b;
		scanf("%d, %d", &a,&b);
		swap(vertical_bar[a-1], vertical_bar[b-1]);
	}
	
	for(i=0;i<w;i++){
		cout << vertical_bar[i] <<endl;
	}
	
	return 0;
}

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

int main(){
	int end[35];
	for(int i = 1;i<=30;i++)
		end[i]= i;
	int w;
	int n;
	
	cin >> w;
	cin >> n;
	for(int i = n; i<=n;i++){
		int a,b;
		char c;
		cin >> a;
		cin >> c;
		cin >> b;
		int temp = end[b];
		end[b]=end[a];
		end[a]=temp;
	
	}
	for(int i = 1;i<=w;i++)
		cout << end[i] << endl;
		
	return 0;
}

C++: 
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int vertical;
    int horizon;
    
    cin >> vertical;
    cin >> horizon;
    
    vector<int> numbers;
    REP(i, 0, vertical) {
        numbers.push_back(i+1);
    }
    
    REP(i, 0, horizon) {
        int sa, sb;
        char comm;
        cin >> sa >> comm >> sb;
        swap(numbers[sa-1], numbers[sb-1]);
    }

    REP(i, 0, vertical) {
        cout << numbers.at(i) << endl;
    }

    return 0;
}

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

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

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

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

C++: #include<iostream>

int main(){
	
	char a;
	int w,n,tate[30],b,c,d,i;

	std::cin>>w;
	for(i=1;i<=w;i++){
		tate[i]=i;
		}
	std::cin>>n;
	
	for(i=0;i<n;i++){
		std::cin>>b>>a>>c;
		d=tate[b];
		tate[b]=tate[c];
		tate[c]=d;
		}
		
	for(i=1;i<=w;i++){
		std::cout<<tate[i]<<std::endl;
		}

	return 0;
	
	}

C++: #include<iostream>
#include<vector>
#include<string>
int main(){
	int w,h;
	std::cin>>w>>h;
	std::vector<int> vec(w);
	for(int i=0;i<w;++i)vec[i]=i+1;
	for(int i=0;i<h;i++){
		std::string str;
		std::cin>>str;
		{
			char c=str[0],d=str[2];
			int a=c-'0'-1,b=d-'0'-1;
			int n=vec[a];
			vec[a]=vec[b];
			vec[b]=n;
		}
	}
	for(int i=0;i<w;i++){
		std::cout<<vec[i]<<std::endl;
	}
	return 0;
}