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++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

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


	return 0;
}

C++: #include <stdio.h>
int RideBack[32];
void _swap(int left, int right) {int bk=RideBack[left];RideBack[left]=RideBack[right];RideBack[right]=bk;}
int main() {int N,W,i,j;scanf("%d %d",&W,&N);for (i=1;i<=W;RideBack[i]=i,i++);while (N--) {scanf("%d,%d",&i,&j);_swap(i,j);}for (i=1;i<=W;printf("%d\n",RideBack[i++]));return 0;}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

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

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

int main() {
    int w, n;
    cin >> w >> n;
    vector<int> v(w);
    iota(v.begin(), v.end(), 1);
    while(n--) {
        int an, bn;
        char c;
        cin >> an >> c >> bn;
        
        int a = v[an-1];
        int b = v[bn-1];
        v[an-1] = b;
        v[bn-1] = a;
    }
    for(int i=0; i<w; i++) {
        cout << v[i] << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cstring>

using namespace std;

int main(){
	int widthCount = 0, heightCount = 0;
	string tmp;

	cin >> widthCount >> heightCount;

	vector<int> width(widthCount);
	for(int i = 0; i < widthCount; i++){
		width[i] = i + 1;
	}
	
	pair<int,int> height;
	/*height.first = vector<int>(heightCount,0);
	height.second = vector<int>(heightCount,0);*/

	char *a = new char[4];
	char *tp;

	for(int i = 0; i < heightCount; i++){
		cin >> tmp;
		
		strcpy(a,tmp.c_str());
		
		tp = strtok(a,",");
		height.first = atoi(tp);
		tp = strtok(NULL,",");
		height.second = atoi(tp);

		swap(width[height.first - 1],width[height.second - 1]);

	}

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

	return 0;
}

C++: include<iostream>
using namespace std;
int main(){
    int w,n,tmp;
    cin>>w>>n;
    int a[w];
    string s;
    for(int i=0;i<w;i++) a[i]=i+1;
    for(int i=0;i<n;i++){
        cin>>s;
        int x=s[0]-(int)'1',y=s[2]-(int)'1';
        tmp=a[x];
        a[x]=a[y];
        a[y]=tmp;
    }
    for(int i=0;i<w;i++) cout<<a[i]<<endl;
    return 0;
}

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

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[5];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[len];
    for(int i = 0; i < len; i++){
        array[i] = i+1;
    }
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

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

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int w, n;
	cin >> w;
	cin >> n;
	vector<P> Vec(n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d,%d", &Vec[i].first, &Vec[i].second);
	}
	vector<int> Answer(w + 1);
	int pos;
	for(int i = 1; i <= w; ++i)
	{
		pos = i;
		for(int j = 0; j < n; ++j)
		{
			if(pos == Vec[j].first)
			{
				pos = Vec[j].second;
			}
			else if(pos == Vec[j].second)
			{
				pos = Vec[j].first;
			}
		}
	Answer[pos] = i;
	}
	for(int i = 1; i <= w; ++i)
	{
		cout << Answer[i] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){

	using namespace std;

	vector<int> array;
	int w,n;
	int a,b,i,j,k;
	
	scanf("%d %d\n",&w,&n);
	
	for(i=0;i<w;i++){
		array.push_back(i+1);
	}
	
	for(i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		k=array[a-1];
		array[a-1]=array[b-1];
		array[b-1]=k;
	}
	
	for(i=0;i<w;i++){
		cout << array[i] << endl;
	}
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


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

C++: #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <istream>
#include <iomanip>
 
#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int w = 0;
	int n = 0;
	int a = 0;
	int b = 0;
	char tmp = 0;
	std::vector<int> z;
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	ifs >> w >> n;
#else
	std::cin >> w >> n;
#endif

	z.resize(w);
	for(int i = 0; i < w; i++){
		z[i] = i + 1;
	}
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a >> tmp >> b;
#else
		std::cin >> a >> tmp >>  b;
#endif
		std::swap(z[a - 1], z[b - 1]);
	}
	for(int i = 0; i < w; i++){
		std::cout << z[i] << std::endl;
	}
	return 0;
}

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

int main(){
	int w, n, num[31], damy, i, j, bou1, bou2;

	cin >> w >> n;

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

	for(i = 0; i < n; i++){
		scanf("%d,%d", &bou1, &bou2);
		damy = num[bou1];
		num[bou1] = num [bou2];
		num[bou2] = damy;
	}

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