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++: //--------------------------------------------------template----------------------------------------//
//c
#include <stdio.h>
#include <time.h>
#include <math.h>
//c++
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <complex>
#include <cmath>
//c++11
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.rbegin(),v.rend())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int w, n;

int a[31], b[31];

int main() {
	cin >> w >> n;
	map<int, int> m;
	for (int i = 0; i < w; i++) {
		m[i + 1] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		int c, d;
		scanf("%d,%d", &c, &d);
		int temp = m[c];
		m[c] = m[d];
		m[d] = temp;
	}
	for (int i = 1; i <= w; i++) {
		cout << m[i] << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>


using namespace std;

int main() {
    size_t w;
    scanf("%zu", &w);
    vector<size_t> dlots(w);
    iota(dlots.begin(), dlots.end(), 1);

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

    for (size_t i=0; i<w; ++i)
        printf("%zu\n", dlots[i]);

    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,i,z,x[1000];
	char w[10];
	scanf("%d %d",&a,&b);
	for(i=0;i<a;i++){
		x[i]=0;
		x[i]=i+1;
	}
	z=0;
	for(i=0;i<b;i++){
		scanf("%d %c %d",&c,w,&d);
		z=x[c-1];
		x[c-1]=x[d-1];
		x[d-1]=z;
	}
	for(i=0;i<a;i++){
		printf("%d\n",x[i]);
	}
	return 0;
}

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

void swap(int *x, int*y)
{
	int temp=0;

	temp = *x;

	*x = *y;

	*y = temp;
}

int main()
{
	int w=0, n=0;

	std::cin >> w >> n;

	std::vector<int> order;

	for(int i=0; i<=w; ++i)
	{
		order.push_back(i);//1〜wまで添え字を使用
	}

	int a=0,b=0;

	char c;

	for(int i=0; i<n; ++i)
	{
		std::cin >> a >> c >> b; 

		swap(&order[a], &order[b]);
	}

	for(int i=1; i<=w; ++i)
	{
		std::cout << order[i] << '\n';
	}

}

C++: #define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

int main(){
    int n,w;
    cin >> w >> n;
    int a[100];
    rep(i,w) a[i] = i+1;
    rep(i,n){
        int x,y;
        char c;
        cin >> x >> c >> y;
        swap(a[x-1],a[y-1]);
    }
    rep(i,w) cout << a[i] << endl;
}

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>
#include <typeinfo>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
	ll w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		std::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]);
		}
		ll 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++: #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
	int w;
	int n;
	int ary[30];

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

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

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


	return 0;
}

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

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

C++: #include <stdio.h>

int main(void) {
	int w,n, a[30][2],i,c,no,rs[30];
	
	scanf("%d%d",&w,&n);
	for(i = 0; n > i; i++){
		scanf("%d",&a[i][0]);
		getchar();
		scanf("%d",&a[i][1]);
	}
	
	for(i = 1; w >= i; i++){
		no = i;
		for(c = 0; n > c; c++){
			if(a[c][0] == no) no = a[c][1];
			else if(a[c][1] == no) no = a[c][0];
		}
		rs[no-1] = i;
	}
	for(i = 0; w > i; i++){
		printf("%d\n",rs[i]);
	}
	
	return 0;
}

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

int main(void){
	int w,n,x,y,temp;
	int a[31];
	char c;
	string str;
	for(int i = 0; i < 31; i++){
		a[i] = i;
	}
	cin >> w >> n;
	for(int i = 0; i < n; i++){
		cin >> str;
		istringstream is(str);
		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 w,n;
  int a[40];
  for(int i=0; i<40; i++){
    a[i] = i;
  }
  cin >> w >> n;
  for(int i=0; i<n; i++){
    int s,t;
    char c;
    cin >> s >> c >> t;
    swap(a[s],a[t]);
  }
  for(int i=1; i<=w; i++){
    cout << a[i] << endl;
  }
  return 0;
}