Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	lines, _ := strconv.Atoi(sc.Text())
	l := make([]int, lines)
	for i := 0; i < lines; i++ {
		l[i] = i + 1
	}

	sc.Scan()
	rows, _ := strconv.Atoi(sc.Text())
	for i := 0; i < rows; i++ {
		sc.Scan()
		s := strings.Split(sc.Text(), ",")
		a, _ := strconv.Atoi(s[0])
		b, _ := strconv.Atoi(s[1])

		l[a-1], l[b-1] = l[b-1], l[a-1]
	}
	for _, j := range l {
		fmt.Println(j)
	}
}

C++: #include<iostream>
#include<stdio.h>
#include<stdlib.h>

using namespace std;

int main(void) {


	//0011
	int Line[31], w=0, n=0, a, b, tmp;
	cin >> w;
	cin >> n;
	for (int i=0; i < 30; i++) {
		Line[i] = i;
	}
	for (int j = 0; j < n; j++) {
		scanf("%d,%d", &a, &b);
		tmp = Line[a];
		Line[a] = Line[b];
		Line[b] = tmp;
	}
	for (int k = 1; k <= w; k++) {
		cout << Line[k] << endl;
	}


	return 0;
}

C++: // 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#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
int main()
{
	int w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	int a[32];
	for (int i = 0; i < 32; i++)
	{
		a[i] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		string d[2];
		for (int i = 0; i < s.length; i++) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		int swap[2];
		for (int i = 0; i < 2; i++) {
			swap[i] = stoi(d[i]);
		}
		int before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	for (int i = 0; i < n; i++) {
		cout << a[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int w,n;
  cin >> w >> n;
  int d[w+1];
  for(int i = 1 ; i <= w ; i++ )d[i] = i;
  for(int i = 1 ; i <= n ; i++ ){
    int a,b;
    char c;
    cin >> a >> c >> b;
    swap(d[a],d[b]);
  }
  for(int i = 1 ; i <= w ; i++ )cout << d[i] << endl;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	int w, n;
	cin >> w>> n;
	int temp[30];
	char s;
	int a[30], b[30];
	for (int i = 0;i < w;i++) {
		temp[i] = i + 1;
	}
	for (int i = 0;i < n;i++) {
		cin >> a[i] >> s >> b[i];
		int tempa;
			int tempb;
			tempa = temp[a[i]-1];
			tempb = temp[b[i]-1];
			temp[a[i]-1] = tempb;
			temp[b[i]-1] = tempa;
	}
	for (int i = 0;i < w;i++) {
		cout << temp[i] << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
    int w,n;
    int a[30]={-1};
    int j,k;
    int temp,temp1;
    
    while(cin >> w){
        
        if(w==0)break;

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

        cin >> n;       

        for(int i=0;i<n;i++){

            cin >> j >> temp >> k;
            
            temp1=a[j-1];
            a[j-1]=a[k-1];
            a[k-1]=temp1;

        }

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

    return 0;
}

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

int main(){
	int w,n;
	cin >> w >> n;
	int num[w + 1];
	for(int i = 1; i <= w; i++)num[i] = i;
	int a,b,temp;
	char c;
	while(cin >> a >> c >> b){
		temp = num[a];
		num[a] = num[b];
		num[b] = temp;
	}
	for(int i = 1; i <= w; i++)cout << num[i] << endl;
}

C++: #include <iostream>
#include <stdlib.h>

using namespace std;

int main(){
	int VLineNum, HLineNum;
	cin >> VLineNum;
	cin >> HLineNum;

	int* Data = new int[VLineNum];//あみだくじNo.配列初期化
	for (int i = 0; i < VLineNum; ++i){
		Data[i] = i + 1;
	}

	int a, b, temp;//データロード&あみだくじ数値反転
	for (int i = 0; i < HLineNum; ++i){
		scanf("%d,%d", &a, &b);
		temp = Data[b-1];
		Data[b-1] = Data[a-1];
		Data[a-1] = temp;
	}

	for (int i = 0; i < VLineNum; ++i){//出力
		cout << Data[i] << endl;
	}

	delete [] Data;

	return 0;
}

C++: // 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#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;
		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<cstdio>
using namespace std;
int main(){
	int n,m;
	int row[30];
	cin >>n>>m;
	for(int i=0; i<n; i++){row[i] = i+1;}
	for(int i=0; i<m; i++){
		int a,b;
		scanf("%d,%d",&a,&b);
		int c = row[a-1];
		row[a-1] = row[b-1];
		row[b-1] = c;
	}
	for(int i=0; i<n; i++){cout <<row[i]<<endl;}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	int n , w , i , j , a , b;
	int number[31] ;
	cin >> w ;
	cin >> n;
	for( i=1 ; i<=n ; i++ ){
		scanf( "%d,%d" , &a , &b );
		int x = number[a];
		number[a] = number[b];
		number[b] = x ;
	}
	for( i=1 ; i<=w ; i++ )
		cout << number[i] << endl;
}

C++: #include <cstdio>

using namespace std;

int main(void){
	int w, n, i, j, m[30][30], a, b, l;
	scanf("%d%d",&w,&n);
	for(i = 0;i < n;i++){
		for(j = 0;j < w;j++){
			m[i][j] = j;
		}
	}
	for(i = 0;i < n;i++){
		scanf("%d%*c%d",&a,&b);
		m[i][b - 1] = a - 1;
		m[i][a - 1] = b - 1;
	}
	for(i = 0;i < w;i++){
		l = i;
		for(j = n - 1;j >= 0;j--){
			l = m[j][l];
		}
		printf("%d\n",l + 1);
	}
	return 0;
}

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

using namespace std;

int main(void) {
	int w, n;
	cin >> w >> n;
	int *line = new int[w];
	for (int i = 0; i < w; i++)
		line[i] = i+1;
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d,%d", &a, &b);
		a--, b--;
		line[a] ^= line[b];
		line[b] ^= line[a];
		line[a] ^= line[b];
	}
	for (int i = 0; i < w; i++)
		cout << line[i] << endl;
	delete[] line;
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

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

	int kuji[n];
	for (int i = 1; i <= w; i++) kuji[i] = i;

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

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

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

int main()
{
    int w, n, num[31];
    int i;

    cin >> w;

    for (i = 1; i <= w; i++){
        num[i] = i;
    }

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

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