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<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,m;
  int lot[30];
  cin >>n>>m;
  for(int i=0; i<n; i++)
    lot[i] = i+1;
  while(m--){
    int x,y,z;
    scanf("%d,%d",&x,&y);
    z = lot[x-1];
    lot[x-1] = lot[y-1];
    lot[y-1] = z;
  }
  for(int i=0; i<n; i++)
    cout <<lot[i]<<endl;
  return 0;
}

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

int main() {
	int w;
	int n;
	cin >> w >> n;
	int* tate = new int[w];
	for (int i = 0; i < w; i++) {
		tate[i] = i + 1;
	}
	int* yoko_a = new int[n];
	int* yoko_b = new int[n];
	for (int i = 0; i < n; i++) {
		scanf("%d,%d", &yoko_a[i], &yoko_b[i]);
	}
	for (int i = 0; i < n; i++) {
		swap(tate[yoko_a[i]-1], tate[yoko_b[i]-1]);
	}
	for (int i = 0; i < w; i++) {
		cout << tate[i] << endl;
	}
}

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

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


}

C++: #include<iostream>
#include <stdio.h>
using namespace std;
int w[30],n,space;
int main(){
	int wa;
	cin>>wa>>n;
	for(int i=0;i<wa;i++){
	w[i]=i+1;}
	for(int i=0;i<n;i++){
	int a,b;char c;
	cin>>a>>c>>b;
	space=w[a-1];w[a-1]=w[b-1];w[b-1]=space;}
	for(int i=0;i<wa;i++){
	cout<<w[i]<<endl;}
	return 0;}

C++: #include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
	int num[30], w, n, a, b;
	char c;
	for(int i = 1; i <= 30; i++){
		num[i-1] = i;
	}
	cin >> w >> n;
	while(cin >> a >> c >> b){
		swap(num[a-1], num[b-1]);
	}
	for(int i = 0; i < w; i++){
		cout << num[i] << endl;
	}
	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;
		cin >> a >> b;

		int tmp = s[a-1];
		s[a-1] = s[b-1];
		s[b-1] = tmp;
	}

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

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

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

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

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>
#include<string>
#include<vector>
using namespace std;

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

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

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

    int amida[33];
    for (int i = 0; i <= 31; ++i)
        amida[i] = i;
    int w, n;
    int a, b;
    std::string s;
    std::cin >> w;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> s;
        a = s.at(0) - '0';
        b = s.at(2) - '0';
        amida[32] = amida[a];
        amida[a] = amida[b];
        amida[b] = amida[32];
    }
    for (int i = 1; i <= w; ++i)
        std::cout << amida[i] << std::endl;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define all(c) (c).begin(), (c).end()

using namespace std;
template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, T b) { if(b < a) a = b; }

int main() {
	int W,N;
	vector<int> nums;

	cin >> W;
	rep(i,W) {
		nums.push_back(i+1);
		//cout << i+1;
	}
	//cout << endl;

	string a_str;
	cin >> N;
	rep(i,N) {
		cin >> a_str;
		int left = a_str[0] - '0';
		int right = a_str[2] - '0';
		int tmp = nums[left-1];
		nums[left-1] = nums[right-1];
		nums[right-1] = tmp;
	}
	rep(i,nums.size()) {
		cout << nums[i] << endl;
	}

	return 0;
}

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

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

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

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

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

using namespace std;

int main() {
    int W, N;
    cin >> W >> N;

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