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
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>

// repetition
// ----------------------------------------------------------------------------
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))

// debug
// ----------------------------------------------------------------------------
#define DEBUGNUM(x) printf("%d\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORNUM(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPNUM(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }

// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")

// constant
// ----------------------------------------------------------------------------
#define INF 1000000000

int main(void)
{
    int i, j;
    int num;
    int side_num;
    int a, b;

    scanf("%d", &num);

    int list[num];

    scanf("%d", &side_num);

    for (i = 0,j = 1; i < num; ++i, ++j){
        list[i] = j;
    }

    for (i = 0;i < side_num; ++i){
        scanf("%d, %d", &a, &b);

        list[a - 1] ^= list[b - 1];
        list[b - 1] ^= list[a - 1];
        list[a - 1] ^= list[b - 1];
    }

    for (i = 0;i < num; ++i){
        printf("%d\n", list[i]);
    }

    return 0;
}

C++: #include <cstdio>

const int W_MAX = 30;
const int N_MAX = 30;

int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];

void chenge(int *farst, int *second){
	int tmp;
	tmp = *farst;
	*farst = *second;
	*second = tmp;
}

int main(void){
	scanf("%d", &w);
	scanf("%d", &n);

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

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

	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <numeric>
#include <sstream>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

//================================================

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int W, N;
	vector<int> vec(40, 0);
	REP(i, 40) {
		vec[i] = i;
	}

	cin >> W >> N;
	REP(i, N) {
		int A, B;
		char C;
		cin >> A >> C >> B;
		swap(vec[A], vec[B]);
	}

	REP2(i, 1, W + 1) {
		cout << vec[i] << endl;
	}
	return 0;
}

C++: using namespace std;

pair<int, int> p;
int a[31];

int main()
{
	int w, n, r;
	cin >> w >> n;
	for (int i = 1; i < w + 1; i++)
		a[i] = i;
	for (int i = 0; i < n; i++)
	{
		scanf("%d,%d", p.first, p.second);
		r = a[p.first];
		a[p.first] = a[p.second];
		a[p.second] = r;
	}
	for (int i = 1; i < w + 1; i++)
	{
		cout << a[i] << endl;
	}
	return 0;
}

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

int w,n ;
int x,y ;

char otaku ;

int LenLine[31] ;

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

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

	for( int i = 0 ; i < n ; i ++ )
	{
		cin >> x >> otaku >> y ;

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

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

	return 0 ;
}

C++: #define _CRT_SECURE_NO_WARNINGS 1

#include <cstdio>

using namespace std;

int main()
{
	int W, N, A[31], B[31], C[31];

	cin >> W >> N;

	for (int i = 1; i <= N; i++)
	{
		scanf("%d,%d", &(A[i]), &(B[i]));
	}

	for (int i = 1; i <= W; i++)
	{
		int t = i;

		for (int j = 1; j <= N; j++)
		{
			if (A[j] == t)
			{
				t = B[j];
			}
			else if (B[j] == t)
			{
				t = A[j];
			}
		}

		C[t] = i;
	}

	for (int i = 1; i <= W; i++)
	{
		printf("%d\n", C[i]);
	}

	return 0;
}

C++: #include<cstdio>

int DP[31];
int w,n;


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

C++: #include<iostream>

int main(){
	int w,n,i,a,b,d,f,e[31];
	char c;

	scanf("%d",&w);
	scanf("%d",&n);

	for(i=1;i<=w;i++){
	e[i]=i;
	}
	for(i=0;i<n;i++){
		std::cin>>a>>c>>b;
		d=e[a];
		e[a]=e[b];
		e[b]=d;
	}

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

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

int main(){
	int n, m;
	cin >> n >> m;
	int a[n];
	for(int i = 0; i < n; i++){
		a[i] = i+1;
	}
	for(int i = 0; i < m; i++){
		stringstream ss1, ss2;
		string str;
		int p, q;
		cin >> str;
		ss1 << str[0];
		ss2 << str[2];
		ss1 >> p;
		ss2 >> q;
		swap(a[p-1],a[q-1]);
	}
	for(int i = 0; i < n; i++){
		cout << a[i] << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    // default
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
    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;
    }
  } // while loop out
  return 0;
}

C++: #include<iostream>

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 <iostream>

using namespace std;

#define MAX_N (30)

void swap(int *a, int *b)
{
    int tmp;
    
    tmp = *a;
    *a = *b;
    *b = tmp;
}

int main()
{
    int w;  // 縦線
    int n;  // 横線
    int a, b;
    char c;
    int amida[MAX_N];
    
    cin >> w;
    for (int i = 0; i < w; i++){
        amida[i] = i + 1;
    }
    
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a >> c >> b;
        swap(&amida[a - 1], &amida[b - 1]);
    }
    
    for (int i = 0; i < w; i++){
        cout << amida[i] << endl;
    }
}