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>

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+1];
	
	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++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int w,n;
    cin>>w>>n;
    int na[31];
    for(int i=1;i<=w;++i){
        na[i]=i;
    }
    for(int i=0;i<n;++i){
        int a,b;
        cin>>a;
        cin.ignore();
        cin>>b;
        swap(na[a],na[b]);
    }
    for(int i=1;i<=w;++i){
        cout<<na[i]<<endl;
    }
    return 0;
}

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

#include "stdafx.h"
#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>
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;
		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] = stoi(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;
}

C++: #include <iostream>
#include <stdio.h>

using namespace std;

int main(){
    int w, n;
    int d[31];
    char s[30];
    while(~scanf("%d %d", &w, &n)){
        for(int i=1;i<=w;i++) d[i] = i;
        for(int i=0;i<n;i++){
            scanf("%s", s);
            int a, b;
            sscanf(s, "%d,%d", &a, &b);
            swap(d[a], d[b]);
        }
        for(int i=1;i<=w;i++) cout << d[i] << endl;
    }
}

C++: #include<iostream>
using namespace std;
 int num[31];
void swap(int a,int b){
  int c = num[a];
  num[a]=num[b];
  num[b]=c;
  

}


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

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

using namespace std;

int main() {

	int i, w, n, a, b, x[31];

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


	for(i=1; i<=n; i++) {
		scanf("%d,%d", &a, &b);
		int t=x[a];
		x[a]=x[b];
		x[b]=t;
	}

	for(i=1; i<=w; i++) {
		cout << x[i] << 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 <iostream>
#include <algorithm>
using namespace std;
int main(){
	int w,n,a,b,ans[30];
	cin>>w>>n;
	for(int i=1;i<=w;i++){
		ans[i]=i;
	}
	for(int i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		swap(ans[a],ans[b]);
	}
	for(int i=1;i<=w;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>

using namespace std;

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

C++: #include<stdio.h>
#include<iostream>

using namespace std;


void swap(int* a,int s,int v){
	int c;
	c=a[s];
	a[s]=a[v];
	a[v]=c;
	return;
}

int main(){
	int w,n;
	int ans[100];
	int sw[2];
	
	scanf("%d %d",&w,&n);
	int i;
	for(i=1;i<=w;i++){
		ans[i]=i;
	}
	for(i=0;i<n;i++){
		sw[1]=sw[0]=0;
		scanf("%d,%d",&sw[0],&sw[1]);
		swap(ans,sw[0],sw[1]);
	}
	
	for(i=1;i<=w;i++){
		printf("%d\n",ans[i]);
	}
	
	return 0;
}

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

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

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
long i,ww,n,a,b,w[31],t;
char c;
cin>>ww>>n;
for(i=1;i<=ww;i++)w[i]=i;
for(i=1;i<=n;i++){
cin>>a>>c>>b;
t=w[a];w[a]=w[b];w[b]=t;
}
for(i=1;i<=ww;i++)cout<<w[i]<<endl;
return 0;
}

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

using namespace std;

int main() {
    int lot[31];
    int w,n;
    
    for(int i=1;i<=30;i++){
        lot[i]=i;
    }

    cin>>w>>n;
    for(int i=0;i<n;i++){
        int a,b;
        (cin>>a).ignore()>>b;
        swap(lot[a],lot[b]);
    }
    for(int i=1;i<=w;i++){
        cout<<lot[i]<<endl;
    }
    return 0;
}

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

int main(){
int w = 0;
cin >> w ;
int n = 0;
cin >> n;
int i = 1;
int a[w];
loop(i = 0,i < w,i++){
a[i] = i + 1;
}
loop(i = 1,i <= n,i++){
int aa = 0;int bb = 0;
char split;
cin >> aa >> split >> bb ;
int c = 0;
c = a[aa - 1];
a[aa - 1] = a[bb - 1];
a[bb - 1] = c;
}
loop(i = 0,i < w, i++)
{
cout << a[i] << endl;
}
    return 0;
}