Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	w := nextInt()
	n := nextInt()

	numbers := make([]int, w+1)
	for i := 1; i <= w; i++ {
		numbers[i] = i
	}

	for i := 0; i < n; i++ {
		line := nextString()
		words := strings.Split(line, ",")
		a, _ := strconv.Atoi(words[0])
		b, _ := strconv.Atoi(words[1])

		numbers[a], numbers[b] = numbers[b], numbers[a]
	}

	for i := 1; i <= w; i++ {
		fmt.Println(numbers[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 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;
		string d[2];
		roop(i, s.length()) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		ll swap[2];
		roop(i, 2) {
			swap[i] = stoll(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++: #include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;


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

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int n;
    cin>>n;
    int k;
    cin>>k;
    int ami[n+1];
    for(int i=0;i<n+1;i++){
        ami[i]=i;
    }
    for(int i=0;i<k;i++){
        int a,b;
        char c;
        cin>>a>>c>>b;
        swap(ami[a],ami[b]);
    }
    
    for(int i=1;i<n+1;i++){
        
        
        cout<<ami[i]<<endl;
    }
    
}

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

using namespace std;

int main() {
	int i, j, l, num[31], w, n, a=0, b=0, c;
	char s[5], as[2], bs[2];
	
	cin >> w;
	for (i = 1; i <= w; i++) {
		num[i] = i;
	}
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> s;
		for (j = 0; s[j] != ','; j++) {
			as[j] = s[j];
		}
		for (l=j; s[j + 1] != NULL; j++) {
			bs[j - l] = s[j + 1];
		}
		a = atoi(as);
		b = atoi(bs);
		c = num[a];
		num[a] = num[b];
		num[b] = c;
	}
	for (i = 1; i <= w; i++) {
		cout << num[i] << endl;
	}
	return 0;
}

C++: #include <iostream>

const int W_MAX = 30;
const int N_MAX = 30;

int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];

void chenge(int *farst, int *second){
	int tmp;
	tmp = *farst;
	*farst = *second;
	*second = tmp;
}

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

	std::cin >> w;
	std::cin >> n;

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

	for(int i = 1; i <= n; i++){
		std::cin >> a[i] >> b[i];
		chenge(&out[a[i]], &out[b[i]]);
	}
	
	for(int i = 1; i <= w; i++){
		std::cout << out[i] << ' ';
	}

	std::cout << '/n';

	return 0;
}

C++: #include<iostream>

using namespace std;

int map[30][31];
int w,n;

void search(int s_x,int x,int y)
{
/*	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<w;j++)
		{
			cout << map[j][i] << " " ;
		}
		cout << endl;
	}
	
	getchar();
	system("cls");
*/	
	if(y==n)
	{
		map[x][n]=s_x+1;
		return ;
	}
	
	if(map[x][y]!=100)
		x=map[x][y];
	
	search(s_x,x,y+1);
}

int main()
{
	int a1,b1;
	int i,j;
	char a;
	
	cin >> w ;
	cin >> n ;
	
	for(i=0;i<=n;i++)
		for(j=0;j<w;j++)
			map[j][i]=100;
	
	for(i=0,j=0;i<n;i++,j++)
	{
		cin >> a1 >> a >> b1 ;
		map[a1-1][j]=b1-1;
		map[b1-1][j]=a1-1;
	}
	
/*	for(i=0;i<=n;i++)
	{
		for(j=0;j<w;j++)
		{
			cout << map[j][i] << " " ;
		}
		cout << endl;
	}
	
	getchar();
	system("cls");
*/	
	for(i=0;i<w;i++)
	{
		search(i,i,0);
	}
	
	for(i=0;i<w;i++)
	{
		cout << map[i][n] << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
inline int nextInt(void){
	int res=0;
	char ch=getchar();
	while(ch>'9'||ch<'0')
		ch=getchar();
	while(ch<='9'&&ch>='0'){
		res=res*10+ch-'0';
		ch=getchar();
	}
	return res;
}
signed main(void){
	int n=nextInt(),m=nextInt();
	int ans[n+1];
	for(int i=1;i<=n;i++)
		ans[i]=i;
	for(int i=1;i<=m;i++)
		swap(ans[nextInt()],ans[nextInt()]);
	for(int i=1;i<=n;i++)
		cout<<ans[i]<<endl;
}

C++: #include<iostream>

using namespace std;

int main() {
	int i, j, l, num[31], w, n, a=0, b=0, c;
	char kanma;
	
	cin >> w;
	for (i = 1; i <= w; i++) {
		num[i] = i;
	}
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a >> kanma >> b;
		c = num[a];
		num[a] = num[b];
		num[b] = c;
	}
	for (i = 1; i <= w; i++) {
		cout << num[i] << endl;
	}
	return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define llong long long

int main() {
  int w,n;
  scanf("%d %d", &w, &n);
  int data[w+1];
  REP(i,w+1){
    data[i] = i;
  }
  REP(i,n) {
    int a,b;
    scanf("%d,%d", &a, &b);
    swap(data[a],data[b]);
  }
  FOR(i,1,w+1) {
    printf("%d\n",data[i]);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int ban[31];
  int a,b;
  int w;
  int n;
  cin >> w >> n;
  for(int i = 1;i <= w;i++){
    ban[i] = i;
  }
  for(int i = 0;i < n;i++){
    scanf("%d,%d",&a,&b);
    swap(ban[a],ban[b]);
  }
  for(int i = 1;i <= w;i++){
    cout << ban[i] << endl;
  }
  return(0);
}

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

using namespace std;

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

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

int main(){
	int w;
	cin>>w;
	vector<int> x(w);
	for(int i=0;i<w;i++)x[i]=i+1;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		int a=s[0]-'0';
		int b=s[2]-'0';
		a--;
		b--;
		int tmp=x[a];
		x[a]=x[b];
		x[b]=tmp;
	}
	for(int i=0;i<w;i++)cout<<x[i]<<endl;
	return 0;
}

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

int main() {

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

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


using namespace std;


int main(){
    
    int w,n,a,b;
    cin >> w >> n;
    vector<int> ans;
    for(int i=0;i<=w;i++){
        ans.push_back(i);
    }

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