Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}

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

using namespace std;

typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define dbg(x) cout << #x"="<< (x) << endl
#define fi first
#define se second

vector<int> change(vector<int> x,int k,int l){
	vector<int> m=x;
	x[k] = m[l];
	x[l] = m[k];
	return x;
}

int main(){
	int w,n;
	cin >> w;
	cin >> n;
	vector<int> ans(w);
	rep(i,w){
		ans[i]=i+1;
	}
	vector<int> m = ans;
	pair<int,int> a;
	string b;
	rep(i,n){
		cin >> b;
		sscanf(b.c_str(),"%d,%d",&a.fi,&a.se);
		m=ans;
		ans[a.fi-1] = m[a.se-1];
		ans[a.se-1] = m[a.fi-1];
	}
	rep(i,w){
		cout << ans[i] << endl;
	}
	
}

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

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

	for(int i=0; i<n; ++i)
	{
		string str;
		cin >> str;
		int dot = str.find(',');
		string numa = str.substr( 0, dot );
		string numb = str.substr( dot+1, str.size()-1 );
		int A,B;
		istrstream( numa.data() ) >> A;
		istrstream( numb.data() ) >> B;
		--A;
		--B;
		int x = line[A];
		line[A] = line[B];
		line[B] = x;
	}

	for(int i=0; i<w; ++i)
	{
		cout << line[i]+1 << '\n';
	}
}

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

using namespace std;

void change(int *x, int *y);

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

void change(int *x, int *y){
	int type = *x;
	*x = *y;
	*y = type;
}

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

int main() {
  int w, n;
  int x[30];
  int a, b, tmp;

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

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;
}