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

int main(){
    int w, n;
    cin >> w >> n;
    int a, b;
    char com;
    vector<int> r;
    for (int i = 0; i <= w; i++) r.push_back(i);
    
    for (int i = 0; i < n; i++){
	cin >> a >> com >> b;
	swap(r[a], r[b]);
    }

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

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,l,n) for(i=l;i<n;i++)


int main(){
	int i,w,n,a,b,c[35],d;
	char k;

	cin>>w;
	cin>>n;
	//cout<<w<<" "<<n<<endl;
	rep(i,1,w+1){
		c[i]=i;
	}
	rep(i,1,n+1){
		cin>>a>>k>>b;
		//cout<<c[a]<<" "<<c[b]<<endl;
		swap(c[a],c[b]);
		//cout<<c[a]<<" "<<c[b]<<endl<<endl;
		
	}
	rep(i,1,w+1){
		cout<<c[i]<<endl;
	}
	

}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int lot[30],n,m;
  for(int i=0; i<30; i++){lot[i] = i+1;}
  cin>>n>>m;
  while(m--){
    int a,b;
    scanf("%d,%d",&a,&b);
    int c = lot[a-1];
    lot[a-1] = lot[b-1];
    lot[b-1] = c;
  }
  for(int i=0; i<n; i++){cout<<lot[i]<<endl;}
  return 0;
}

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

int main() {
	int w, n, a, b;
	char comma;
	vector<int> amida;
	cin >> w >> n;
	for (int i = 0;i < w;i++) amida.push_back(i + 1);

	for (int i = 0;i < n;i++) {
		cin >> a >> comma >> b;
		swap(amida.at(a - 1), amida.at(b - 1));
	}

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

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
    cin.clear();
    // cin.ignore(INT_MAX, '\n');
    for (int i = 0; i < n; ++i) {
      string str, tmp_a, tmp_b;
      int a, b;
      getline(cin, str);
      istringstream iss(str);
      getline(iss, tmp_a, ',');
      getline(iss, tmp_b, ',');
      a = stoi(tmp_a) - 1;
      b = stoi(tmp_b) - 1;
      int tmp = vec[a];
      vec[a] = vec[b];
      vec[b] = tmp;
    }
    for (int i = 0; i < vec.size(); ++i) {
      cout << vec[i] << endl;
    }
  }
  return 0;
}

C++: #include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int main(){
    int w,n;
    int a[50],b[50],ans[50];
    scanf("%d%d",&w,&n);
    REP(i,n)
        scanf("%d,%d",a + i,b + i);

    FOR(i,1,w + 1){
        int now = i;
        REP(j,n){
            if(now == a[j])
                now = b[j];
            else if(now == b[j])
                now = a[j];
        }
        ans[now] = i;
    }
    FOR(i,1,w + 1)
        printf("%d\n",ans[i]);
    return 0;
}

C++: #include <cstdio>

int main()
{
        int w, n;
        int lot[30][30];
        int goal[30];

        scanf("%d", &w);
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
                for (int j = 0; j < w; j++) {
                        lot[i][j] = -1;
                }
        }
        int a, b;
        for (int i = 0; i < n; i++) {
                scanf("%d,%d", &a, &b);
                lot[i][a - 1] = b - 1;
                lot[i][b - 1] = a - 1;
        }
        for (int i = 0; i < w; i++) {
                int cur = i;
                for (int j = 0; j < n; j++) {
                        if (lot[j][cur] >= 0) {
                                cur = lot[j][cur];
                        }
                }
                goal[cur] = i + 1;
        }
        for (int i = 0; i < w; i++) {
                printf("%d\n", goal[i]);
        }

        return 0;
}

C++: #include<cstdio>
int main(){
    int n,w;
    scanf("%d %d",&n, &w);
    int arr[n+1];
    for(int i=0; i<=n; i++)
        arr[i]=i;
    while(w--){
        char s[3];
        //scanf("%s", s);
        //int a=s[0]-'0', b=s[2]-'0';
        int a,b;
        scanf("%d,%d",&a,&b);
        //cin>>a>>,>>b;
        int memo=arr[a];
        arr[a]=arr[b];
        arr[b]=memo;
    }
    for(int i=1; i<=n; i++)
        printf("%d\n", arr[i]);
    return 0;
}

C++: #include<iostream>

int listen_lineCount();
void listen_path(int &from,int &to);

class Lots
{
private:
	int *start_goal;
	int verLineNum;
public:
	Lots(const int lineCount);
	~Lots();
	
	void draw_line(const int from,const int to);
	void echo_goalNums();
};

//-------------------------main--------------------------------

int main()
{
	int ver_lineCount=listen_lineCount();
	Lots inst_lot=Lots(ver_lineCount);
	
	int hor_lineCount=listen_lineCount();
	
	int from,to;
	for(int roop=0;roop<hor_lineCount;roop++)
	{
		listen_path(from,to);
		inst_lot.draw_line(from,to);
	}
	
	inst_lot.echo_goalNums();
	return 0;
}

//--------------------------------------------------------------

Lots::Lots(const int lineCount)
{
	verLineNum=lineCount;
	start_goal=new int(lineCount+2);
	
	for(int roop=1;roop<=lineCount;roop++)
	{
		start_goal[roop]=roop;
	}
}

Lots::~Lots()
{
	delete [] start_goal;
}

void Lots::draw_line(const int from,const int to)
{
	int swap=start_goal[from];
	start_goal[from]=start_goal[to];
	start_goal[to]=swap;
}

void Lots::echo_goalNums()
{
	using namespace std;
	
	for(int roop=1;roop<=verLineNum;roop++)
	{
		cout<<start_goal[roop]<<endl;
	}
}


int listen_lineCount()
{
	using namespace std;
	
	int lineCount;
	cin>>lineCount;
	
	return lineCount;
}

void listen_path(int &from,int &to)
{
	using namespace std;
	
	char delim;//カンマ区切り
	
	cin>>from>>delim>>to;
}

C++: // 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
#include <typeinfo>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
	ll w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		std::string d[2];
		roop(i, s.length()) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		ll swap[2];
		roop(i, 2) {
			swap[i] = std::stoll(d[i]);
		}
		ll before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}