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;

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

C++: #define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

int main(){
    int n,w;
    cin >> w >> n;
    int a[100];
    rep(i,w) a[i] = i+1;
    rep(i,n){
        int x,y;
        char c;
        cin >> x >> c >> y;
        swap(a[x-1],a[y-1]);
    }
    rep(i,w) cout << a[i] << endl;
}

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

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

C++: #include<iostream>
#include<vector>
#include <stdio.h>
int main(){
	int w;
	std::cin>>w;
	std::vector<int> a(w);
	for(int i=1;i<=w;i++)a[i]=i;
	int n;
	std::cin>>n;
	while(n>0){
		int b,c;
		scanf("%d,%d",&b,&c);
		//std::cin>>b>>c;
		int d=a[b];
		a[b]=a[c];
		a[c]=d;
		n--;
	}
	for(int i=1;i<=w;i++)std::cout<<a[i]<<std::endl;
	return 0;
}

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++: /*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/
void Exchange(int *a,int *b){
	int w;
	w = *a;
	*a = *b;
	*b = w;
}
/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	int *goal;
	int w;
	int n;
	int a,b;
	cin >> w >> n;
	goal = new int [w+1];
	for(int i=1;i<=w;i++){
		goal[i] = i;
		//cout << goal[i] << " ";
	}
	//cout << endl;
	for(int i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		Exchange(&goal[a],&goal[b]);
		//cout << goal[a] << " " << goal[b] << endl;
	}
	for(int i=1;i<=w;i++){
		cout << goal[i] << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

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

typedef struct{
	int x;
	int y;
}t_swap;

int main(){
	int m, n;
	char c;

	cin >> m;
	cin >> n;
	int* w = new int[ m + 1 ];
	t_swap* swap = new t_swap[ n ];

	for ( int i = 0; i < n; ++i ){
		cin >> swap[ i ].x >> c >> swap[ i ].y;
	}

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

	for ( int i = 0; i < n; ++i ){
		int t = w[ swap[ i ].x ];
		w[ swap[ i ].x ] = w[ swap[ i ].y ];
		w[ swap[ i ].y ] = t;
	}

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


	delete[] swap;
	delete[] w;

	return 0;
}

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

#define WMAX 30
#define NMAX 30

int v_pos[WMAX]; // ??????????????????????????????????????¶???

void exchange(int v_pos[], int a, int b){
	swap(v_pos[a], v_pos[b]);
}

int main(){
	int w, n;
	int a, b;
	char input[6], *token1, *token2;
	cin >> w >> n;
	for(int i=1;i<=w;i++){
		v_pos[i] = i;
	}

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

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

void swap(int* x, int* y) {
	int temp = *x;
	*x = *y;
	*y = temp;
}

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

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

	int ops;
	cin >> ops;

	while (ops--) {
		int x, y;
		scanf("%d,%d", &x, &y);

		swap(a[x], a[y]);
	}

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

	return 0;
}

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

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