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++: #define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>

using namespace std;

int w, n;
int ans[30];
int main()
{
    cin >> w >> n;
    REP(i, w) {
        ans[i] =i + 1;
    }
    REP(i, n) {
        char c;
        int a, b;
        cin >> a >> c >> b;
        a--;b--;
        int tmp = ans[a];
        ans[a] = ans[b];
        ans[b] = tmp;
    }
    REP(i, w) {
        cout << ans[i] << endl;
    }
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <algorithm>

using namespace std;

int main(int argc, char const* argv[])
{
    int w,n,x,y;
    scanf("%d ", &w);
    int *ar = new int[w];
    for (int i = 0; i < w; i++) {
        ar[i] = i + 1;
    }

    scanf("%d ", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d,%d ", &x, &y);
        swap(ar[x - 1], ar[y - 1]);
    }
    for (int i = 0; i < w; i++) {
        printf("%d\n", ar[i]);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int w,n;//1~wまでの番号を用意、ｎ回の操作
    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;
    //コンマの入力,temp使用        
        for(int i=0;i<n;i++){
            cin >> j  >> temp >> k;
            temp1=a[k];
            a[j]=a[k];
            a[k]=temp1;
        }

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

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

int main(int argc, char *argv[]) {
	using namespace std;
	
	int vertNum, horiNum;
	fscanf(stdin, "%d", &vertNum);
	fscanf(stdin, "%d", &horiNum);
	
	vector<int> list(vertNum);
	for (int i = 0; i < vertNum; i++) {
		list[i] = i+1;
	}
	
	int tmp1, tmp2;
	for (int i = 0; i < horiNum; i++) {
		fscanf(stdin, "%d,%d", &tmp1, &tmp2);
		swap(list[tmp1-1], list[tmp2-1]);
	}
	
	for (int i = 0; i < vertNum; i++) {
		printf("%d\n", list[i]);
	}
	return 0;
}

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

int main(){

	int w, n;
	int num[30] = { 0 };
	int a, b;

	cin >> w;
	cin >> n;

	for (int i = 0; i<w; i++)
		num[i] = i + 1;

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

		cin >> a >> b;

		int tmp = num[a-1];
		num[a-1] = num[b-1];
		num[b-1] = tmp;


	}


	for (int i = 0; i<w; i++)
		cout << num[i] << "\n";

	return 0;

}

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

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

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

int main(){
    int w, n;
    cin >> w;
    cin >> n;
    int stick[31] = {0};
    for(int i = 1; i <= w; i++){
        stick[i] = i;
    }

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

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

    return 0;
}

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

int main(int argc, const char * argv[]) {
    std::vector<int> r;
    int w,n;
    int a,b;
    std::cin >> w >> n;
    for(int i = 0;i <= w;i++){
        r.push_back(i);
    }
    for(int i = 0; i <= n; i++){
        (std::cin >> a).ignore()>>b;
        std::swap(r[a],r[b]);
    }
    for(int i = 1; i <=w;i++){
        std::cout<< r[i] << std::endl;
        
    }
}

C++: //
//  main.cpp
//  CppTest
//
//  Created by Ryu on 2017/02/08.
//  Copyright ?? 2017??´ Ryu. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int w = 0;
    cin >> w;
    
    int n = 0;
    cin >> n;
    
    int c[w];
    for(int i = 0; i < w; i++){
        c[i] = i + 1;
    }
    
    int a, b;
    int buffer;
    for (int i = 0; i < n; i++) {
        scanf("%d,%d",&a, &b);
        //printf("a: %d, b: %d ;; ", a, b);
        //printf("%d, %d -> ", c[a - 1], c[b - 1]);
        buffer = c[a - 1];
        c[a - 1] = c[b - 1];
        c[b - 1] = buffer;
        //printf("%d, %d\n", c[a - 1], c[b - 1]);
    }
    for (int i = 0; i < w; i++) {
        printf("%d\n", c[i]);
    }
    printf("\n");
    
    
    return 0;
}

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

int main(){
	int w,n,a,b;
	char c;
	cin >> w >> n;
	vector<int> v;
	for(int i = 0; i < w+1; i++){
		v.push_back(i);
	} 
	
	for(int j = 0; j < n; j++){
		cin >> a >> c >> b;
		swap(v[a],v[b]);
	}
	
	for(int k = 1; k < w+1; k++){
		cout << v[k] << "\n";
	}
}

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

int main(){
	const int MAX_w = 30;
	int w, n, a, b, c, p;
	int lots[MAX_w + 1];
	string str;
	
	for(int i = 1; i <= MAX_w; i++){
		lots[i] = i;
	}
	
	cin >> w >> n;
	
	for(int i = 0; i < n; i++){
		a = 0; b = 0;
		cin >> str;
		
		p = 0;
		while(str[p] != ','){
			a = a * 10 + (str[p] - 48);
			p++;
		}
		p++;
		while(p < str.size()){
			b = b * 10 + (str[p] - 48);
			p++;
		}
		
		c = lots[a];
		lots[a] = lots[b];
		lots[b] = c;
	}
	
	for(int i = 1; i <= w; i++){
		printf("%d\n", lots[i]);
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

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

C++: #include <iostream>

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

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

    for (int i = 0; i < n; ++i) {
        int a, b;
        char comma;
        std::cin >> a >> comma >> b;
        int tmp = state[a - 1]; state[a - 1] = state[b - 1]; state[b - 1] = tmp;
    }

    for (int i = 0; i < w; ++i) std::cout << state[i] << std::endl;
}

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

using namespace std;

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