Go: package main

import (
        "fmt"
)

const MAX_N = 31
var lines [MAX_N]int

func main() {
        var n, w int
        fmt.Scanf("%d", &n)
        fmt.Scanf("%d", &w)

        Init()
        var l, r int
        for {
                _, err := fmt.Scanf("%d,%d", &l, &r)
                if err != nil {
                        break
                }

                Swp(l, r)
        }

        for i := 1; i <= n; i++ {
                fmt.Printf("%d\n", lines[i])
        }
}

func Swp(l int, r int) {
        var s int
        s = lines[l]
        lines[l] = lines[r]
        lines[r] = s
}

func Init() {
        for i := 0; i < MAX_N; i++ {
                lines[i] = i
        }
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int W,N;

int main()
{
	scanf("%d%d",&W,&N);
	vector<int> A(W + 1);
	for(int i = 1;i <= W;i++){
		A [i] = i;
	}

	FOR(i,0,N){
		int x,y;
		char c;
		scanf("%d%c%d",&x,&c,&y);
		swap(A [x],A [y]);
	}
	for(int i = 1;i <= W;i++){
		printf("%d\n",A [i]);
	}

	return 0;
}

C++: #include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

pair<int, int> p;
int a[31];

int main()
{
	int w, n, r;
	cin >> w >> n;
	for (int i = 1; i < w + 1; i++)
		a[i] = i;
	for (int i = 0; i < n; i++)
	{
		scanf("%d,%d", p.first, p.second);
		r = a[p.first];
		a[p.first] = a[p.second];
		a[p.second] = r;
	}
	for (int i = 1; i < w + 1; i++)
	{
		cout << a[i] << endl;
	}
	return 0;
}

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

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

C++: #include <cstdio>

int main()
{
    int amida[33];
    for (int i = 0; i <= 31; ++i)
        amida[i] = i;
    int w, n;
    int a, b;
    std::scanf("%d %d", &w, &n);
    for (int i = 0; i < n; ++i) {
        std::scanf("%d,%d", &a, &b);
        amida[32] = amida[a];
        amida[a] = amida[b];
        amida[b] = amida[32];
    }
    for (int i = 1; i <= w; ++i)
        std::printf("%d\n", amida[i]);
}

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

using namespace std;

int main() {

	int w;
	int n;
	int number[30] = {0};
	int kari;
	int a, b;
	char c;

	cin >> w;
	cin >> n;

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

	for(int i = 0; i < n; i++) {
		cin >> a >> c >> b;
		kari = number[a-1];
		number[a-1] = number[b-1];
		number[b-1] = kari;
	}

	for(int i = 0; i < w; i++) {
		printf("%d\n", number[i]);
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

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

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

    while (n--) {
        int i,j;
        scanf("%d,%d", &i, &j);
        swap(a[i-1], a[j-1]);
    }

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

    return 0;
}

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


int main(void)
{
	int w,n;

	cin >> w >> n;

	int d[31];
	for(int i = 0; i < 31; i++)
		d[i] = i;
	int a,b;

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


	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef vector <int> vi;

int str2int(string text){
    stringstream ss;
    ss<<text;
    int tmp;
    ss>>tmp;
    return tmp;
}

int main(void){
    int w=0, n;
	cin>>w;
	vi x(w);
	for (int i=0; i<w; i++)
		x[i] = i+1;

	cin>>n;
	for (int i=0; i<n; i++){
		string text;
		cin>>text;
		string::size_type index = text.find( "," );

		int a, b;
		a = str2int(text.substr(0, index));
		b = str2int(text.substr(index+1));
		swap(x[a-1], x[b-1]);
	}

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

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

using namespace std;


int main(){

	int w[31];
	
	int n,m;
	int a,b;

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

	cin>>n>>m;

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


	return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define EPS 1.0e-8
#define MAX_N 100
typedef pair<int,int> Pii;
typedef pair<int,int> Pis;
const double PI=acos(-1);

int main(){
	int w, n;
	int stage[w];
	int a, b;
	cin >> w >> n;
	rep(i,w) stage[i] = i+1;

	rep(i,n){
		scanf("%d,%d",&a,&b);	
		stage[a-1] ^= stage[b-1];
		stage[b-1] ^= stage[a-1];
		stage[a-1] ^= stage[b-1];
	}

	rep(i,w)	cout << stage[i] << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
char temp;

int n,w;
int m1[40];
int main() {
    scanf("%d", &n);
    scanf("%d", &w);
    for(int i = 1; i <= n;i++)m1[i]=i;
    for(int i = 0; i < w; i++){
        int a,b;
        scanf("%d,%d", &a, &b);
        int temp = m1[b];
        m1[b] = m1[a];
        m1[a] = temp;
    }
    for(int i = 1; i <= n;i++)printf("%d\n", m1[i]);
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>
#include <cmath>
#include <cstdio>

int main(void)
{
  int w, n;

  std::cin >> w >> n;

  std::vector<int> base;
  for (int i = 0; i < w; i++) {
    base.push_back(i + 1);
  }

  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d,%d", &a, &b);
    std::swap(base[a - 1], base[b - 1]);
  }

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

  return 0;
}

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]);
    }
    
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int w, n;
	cin >> w >> n;
	int s[w];

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

	for(int t=0; t<n; t++){
		int a, b;
		char c;
		cin >> a >> c >> b;
		swap(s[a-1], s[b-1]);
	}

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

	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

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

	vector<int> s(w);
	for (int i = 1; i <= w; ++i)
		s[i] = i;

	while (n--)
	{
		int a, b;
		scanf("%d,%d", &a, &b);

		swap(s[a], s[b]);
	}

	for (int i = 1; i <= w; ++i)
		cout << s[i] << endl;

	return 0;
}