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<cstdio>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

#define ll long long
#define LL long long
#define ULL unsigned long long 
#define ull unsigned long long 
#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--)
#define int(x) int x;scanf("%d",&x);
#define double(x) double x;scanf("%lf",&x);
#define string(x) double string;cin>>x;

using namespace std;

int main()
{
	int w, n;
	int tmp[100] = {};
	scanf("%d %d", &w, &n);
	int a[100], b[100];
	int tmp_num;
	REP(i, w) {
		tmp[i] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		scanf("%d,%d", &a[i], &b[i]);
	}

	for (int i = 0; i < n; i++) {
		tmp_num = tmp[a[i]-1];
		tmp[a[i]-1] = tmp[b[i]-1];
		tmp[b[i]-1] = tmp_num;
	}
	
	REP(i, w) {
		cout << tmp[i] << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#define N 30
using namespace std;
int main(){
????int w,n,tmp;
????int lod[N]; int lis[N][3];
????while(cin >> n >> w){
????for(int i = 0;i<n;i++){
????lod[i] = i+1;
????}
????for(int i=0;i<w;i++){
????scanf("%d,%d",&lis[i][0],&lis[i][2]);
????}
????for(int i=0;i<w;i++){
????tmp = lod[lis[i][0]-1];
????lod[lis[i][0]-1] = lod[lis[i][2]-1];
????lod[lis[i][2]-1] = tmp;
????}
????for(int i=0;i<n;i++){
????cout << lod[i] << endl;
????}
}

C++: #include <stdio.h>

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

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

using namespace std;

int main(){
    int w, n;
    int d[31];
    while(~scanf("%d %d", &w, &n)){
        for(int i=1;i<=w;i++) d[i] = i;
        for(int i=0;i<n;i++){
            int a, b;
            scanf("%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 main() {
	int w, n, a, b, c[31], i, d;
	char e;
	cin >> w >> n;
	for (i = 1; i <= w; i++) {
		c[i] = i;
	}
	for (i = 0; i < n; i++) {
		cin >> a >> e >> b;
		d = c[a];
		c[a] = c[b];
		c[b] = d;
	}
	for (i = 1; i <= w; i++) {
		cout << c[i] << endl;
	}
}

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

int main() {
	int w, n, x, y;
	string str;
	cin >> w >> n;
	int a[31];
	for (int i = 0; i <= w; i++) {
		a[i] = i;
	}
	for (int i = 0; i < n; i++) {
		cin >> str;
		x = str[0] - 48;
		y = str[2] - 48;
		int tmp = a[x];
		a[x] = a[y];
		a[y] = tmp;
	}
	for (int i = 1; i <= w; i++) {
		cout << a[i] << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#define N 30
using namespace std;
int main(){
????int w,n,tmp;
????int lod[N]; int lis[N][3];
????while(cin >> n >> w){
????for(int i = 0;i<n;i++){
????lod[i] = i+1;
????}
????for(int i=0;i<w;i++){
????scanf("%d,%d",&lis[i][0],&lis[i][2]);
????}
????for(int i=0;i<w;i++){
????tmp = lod[lis[i][0]-1];
????lod[lis[i][0]-1] = lod[lis[i][2]-1];
????lod[lis[i][2]-1] = tmp;
????}
????for(int i=0;i<n;i++){
????cout << lod[i] << endl;
????}
  return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int main(void)
{
  char hoge;
  int v, h, a, b, tmp;
  cin >> v;
  cin >> h;
    
  int bar[v];
  for (int i = 0; i < v; i++)
    bar[i] = i+1;
      
  for (int i = 0; i < h; i++) 
  {
    cin >> a >> hoge >> b;
    tmp = bar[a-1];
    bar[a-1] = bar[b-1];
    bar[b-1] = tmp;
  }
    
  for (int i = 0; i < v; i++)
    cout << bar[i] << endl;
   
  return 0;
}

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

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

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

using namespace std;

int main(void) {


	//0011
	int Line[31], w=0, n=0, a, b, tmp;
	cin >> w;
	cin >> n;
	for (int i=0; i < 30; i++) {
		Line[i] = i;
	}
	for (int j = 0; j < n; j++) {
		scanf_s("%d,%d", &a, &b);
		tmp = Line[a];
		Line[a] = Line[b];
		Line[b] = tmp;
	}
	for (int k = 1; k <= w; k++) {
		cout << Line[k] << endl;
	}


	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
int w,n,i;
cin>>w>>n;
int l[w];
for(i=0;i<w;i++){
l[i]=i;
}
for(i=0;i<n;i++){
int a,b,t;
scanf("%d,%d",&a,&b);
t=l[a-1];
l[a-1]=l[b-1];
l[b-1]=t;
}
for(i=0;i<w;i++){
printf("%d\n",l[i]+1);
}
return 0;
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

using namespace std;

vector<int>a;
vector<int>b;
vector<int>c;

int main(){

	int w,n,r,s; char p;

	cin >> w >> n;

	rep(i,n){
	cin >> r;
	a.push_back(r);

    cin >> p;

    cin >> s;
	b.push_back(s);


	}
	rep(i,w)
	c.push_back(i+1);

	rep(i,n)
	iter_swap(c.begin()+a[i]-1,c.begin()+b[i]-1);

	rep(i,w)
	cout << c[i] << endl;



	return 0;
}

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

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

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

int main(void) {
  int A[31];
  int n, w, a, b;
  char ch;

  cin >> w >> n;
  for(int i=1; i<=w; i++) A[i]=i;
  
  for(int i=0; i<n; i++) {
    cin >> a >> ch >> b;    
    swap(A[a], A[b]);
  }

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

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

int main(void) {
    int w;
    int n;
    int place;
    std::cin >> w >> n;
    std::vector<std::pair<int, int> > cource(n);

    std::vector<int> result(w, 0);

    int a;
    int b;
    char temp;

    for (int i = 0; i < n; i++) {
        std::cin >> cource[i].first >> temp >> cource[i].second;
    }


    for (int i = 1; i <= w; i++) {
        place = i;
        for (int j = 0; j < n; j++) {
            if (cource[j].first == place) {
                place = cource[j].second;
            } else if(cource[j].second == place) {
                place = cource[j].first;
            }
        }
        result[place - 1] = i;
    }

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

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int tate[31],yoko;
	int tates;
	char neko;
	scanf("%d%d",&tates,&yoko);
	for(int i = 1;i<=tates;i++)//縦に０からtates番まで入る
	{
		tate[i] = i;
	}
	int amida1,amida2;
	int a = 0;
	for(int j = 0;j<yoko;j++)
	{
		scanf("%d%c%d",&amida1,&neko,&amida2);
		a = tate[amida1];
		tate[amida1] = tate[amida2];
		tate[amida2] = a;
	}
	for(int i = 1;i <=tates;i++)
	{
		printf("%d\n",tate[i]);
	}
	return 0;
}