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 <vector>

using namespace std;

int main(){
    int w, n, a, b;
    vector<pair<int, int>> h_lines;
    cin >> w >> n;
    
    while(scanf("%d,%d",&a,&b)+1){
     h_lines.push_back(pair<int, int>(a,b));   
    }
    
    
    for (int i = 0; i < w; ++i){
        int where = i+1;
        for (auto line:h_lines){
            if (line.first == where){
                where = line.second;
            } else if (line.second == where){
                where = line.first;
            }
        }
        cout << where << endl;
    }
    
 return 0;   
}

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

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)


int main(){
    int w,n,a,b,t;
    int arr[30];
    scanf("%d", &w);
    scanf("%d", &n);
    rep(i,w) arr[i] = i+1;
    while(n--) {
        scanf("%d,%d", &a, &b);
        t = arr[a-1];
        arr[a-1] = arr[b-1];
        arr[b-1] = t;
    }
    rep(i,w) printf("%d\n", arr[i]);
}

C++: #include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main(){
    int w, n;
    int d[31];
    while(cin >> w >> n){
        for(int i=1;i<=w;i++) d[i] = i;
        for(int i=0;i<n;i++){
            string s; cin >> s;
            istringstream iss(s);
            for(int j=0;j<s.size();j++)
                if(s[j]==',') s[j] = ' ';
            int a, b; iss >> a >> b;
            swap(d[a], d[b]);
        }
        for(int i=1;i<=w;i++) cout << d[i] << endl;
    }
}

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

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

rep(i,0,n) {
int x,y;
scanf("%d,%d",x,y);
swap(a[x-1],a[y-1]);
}
rep(i,0,n) cout << a[i] << endl;
return 0;
}

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

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

C++: #pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const int inf = 0x3f3f3f3f;
//#define LOCAL



int main(int argc, char * argv[]) 
{
	#ifdef LOCAL
	freopen("/Users/huangjiaming/Documents/Algorithm/oj/data.in", "r", stdin);
	//freopen("/Users/huangjiaming/Documents/Algorithm/oj/data.out", "w", stdout);
	#endif

	int w, n, a[50], f, s;

	while (~scanf("%d", &w))
	{
		for (int i = 1; i <= w; i++)
			a[i] = i;
		scanf("%d", &n);
		while(n--)
		{
			scanf("%d,%d", &f, &s);
			swap(a[f], a[s]);
		}
		for (int i = 1; i <= w; i++)
			printf("%d\n", a[i]);
	}

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int w,n,a,b;
    char c;
    std::deque<int> deq;
    cin >> w;
    for (int i=1;i<w+1;i++) {
        deq[i]=i;
    }
    cin >> n;
    for (int j=0;j<n;j++) {
        cin >> a >> c >> b;
        /*
        int a = x.at(0)-48;
        int b = x.at(2)-48;
        int tmp = deq[b];
        deq[b] = deq[a];
        deq[a] = tmp;*/
        swap(deq[a],deq[b]);
    }
    for (int k=1;k<w+1;k++) {
        cout << deq[k] << endl;
    }
    deq.clear();
}

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

void initilize(int w,int num[]){
	for(int i=0;i<w;i++)
		num[i]=i+1;
}

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

C++: //AOJ Drowng Lots

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

int main() {
	int w, n;
	int a[30], b[30];
	int x[30];
	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[i], &b[i]);
		a[i]--;
		b[i]--;
		swap(x[a[i]], x[b[i]]);
	}
	for(int i = 0; i < w; i++) {
		cout << x[i] << endl;
	}
	return 0;
}

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

void swap(int &a, int &b) {
	a = a ^ b;
	b = a ^ b;
	a = a ^ b;
}

int main() {
	int W, N;
	cin >> W >> N;
	int start[W];
	for (int w = 0; w != W; ++w) {
		start[w] = w+1;
	}

	int a, b, throwaway;

	for (int n = 0; n != N; ++n) {
		cin >> a;
		cin.get();
		cin >> b;
		swap(start[a-1], start[b-1]);
	}

	for (int w = 0; w != W; ++w) {
		cout << start[w] << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int n;
int a[1000000];
int sum[1000000];
int main(int argc, char const *argv[])
{

	int tc[30];
	cin>>tc[30];
	int w,v;
	for (int i = 0; i < 30; ++i) tc[i] = i+1;
		for (int i = 0; i < v; ++i)
		{
			int a,b;
			cin>>a>>b;
			int c=tc[a-1];
			tc[a-1]=tc[b-1];
			tc[b-1];

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

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int w,n,a[30],b[30],result[30];
  for(int i=0;i<30;i++){
    result[i]=i+1;
  }
  
  cin >>w>>n;
  for(int i=0;i<n;i++){
    scanf("%d,%d",&a[i],&b[i]);
    swap(result[a[i]-1],result[b[i]-1]);
  }

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

C++: #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <queue>
#include <vector>

using namespace std;

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

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

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int i, temp;
  int w, n, ai, bi;

  cin >> w;
  cin >> n;

  vector<int> amida;

  // initialize
  for (i = 0; i < w; i++) {
    amida.push_back(i + 1);
  }

  for (i = 0; i < n; i++) {
    scanf("%d,%d", &ai, &bi);

    // swap
    temp = amida.at(ai - 1);
    amida.at(ai - 1) = amida.at(bi - 1);
    amida.at(bi - 1) = temp;
  }

  for (i = 0; i < w; i++) {
    cout << amida.at(i) << endl;
  }

  return 0;
}