Go: package main

import "fmt"

func main() {
	var w, n, a, b, i, te int
	var amida [31]int
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)
	for i := 1; i <= w; i++ {
		amida[i] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d,%d", &a, &b)
		te = amida[a]
		amida[a] = amida[b]
		amida[b] = te
	}
	for i := i; i <= w; i++ {
		fmt.Printf("%d\n", amida[i])
	}
}

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

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

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

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

C++: #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
int w,n,a,b,ans[30];
cin >> w >> n;
for(int i=0;i<w;i++)ans[i]=i+1;
for(int i=0;i<n;i++){
string ss;
cin >> ss;
swap(ans[(ss[0]-'0')-1],ans[(ss[2]-'0')-1]);
}
for(int i=0;i<w;i++)printf("%d\n",ans[i]);
return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int w, n;
  cin >> w >> n;
  int lots[30];
  for (int i = 0; i < w; i ++) {
    lots[i] = i;
  }
  for (int i = 0; i < n; i ++) {
    char c;
    int a, b;
    cin >> a >> c >> b;
    swap(lots[a - 1], lots[b - 1]);
  }
  for (int i = 0; i < w; i ++) {
    cout << lots[i] + 1 << endl;
  }
}

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

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[5];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[] = {1,2,3,4,5};
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>

using namespace std;

int main(){

	int w, m[40], n, a, b, c;

	cin >> w;
	for (int i = 1; i <= w; i++)
	{
		m[i - 1] = i;
	}
	
	cin >> n;

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

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

C++: #include<iostream>
#include<stdio.h>
using namespace std;
main(){
	int w,n;
	cin>>w>>n;
	int a,b,ans[w+1];
	for(int i=0;i<=w;++i)ans[i]=i;
	for(int i=1;i<=n;++i){
		scanf("%d,%d",&a,&b);
		int tmp;
		tmp=ans[a];
		ans[a]=ans[b];
		ans[b]=tmp;
	}
	for(int i=1;i<=w;++i)cout<<ans[i]<<endl;
}

C++: 

#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

const int MAX_HORIZONTAL = 30;
const int MAX_VERTICAL = 30;

int main(){

	int VerticalLines;
	int HorizontalLines;
	int HorizonA[MAX_HORIZONTAL];
	int HorizonB[MAX_HORIZONTAL];
	int Results[MAX_VERTICAL];



	cin >> VerticalLines;
	cin >> HorizontalLines;
	for (int i = 0; i < HorizontalLines; ++i){ char c[32];  scanf_s("%d,%d", &HorizonA[i], &HorizonB[i]); }

	for (int i = 0; i < VerticalLines; ++i){ Results[i] = i + 1; }

	

	for (int i = 0; i < HorizontalLines; ++i){
		int Swap = Results[HorizonA[i] - 1];
		Results[HorizonA[i]-1] = Results[HorizonB[i] - 1];
		Results[HorizonB[i] - 1] = Swap;
	}

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





	return 0;
}