Go: package main

import "fmt"

func main() {
	var w, n int
	fmt.Scan(&w)
	numbers := make([]int, w)

	fmt.Scan(&n)

	intersect := make([][2]int, n)

	for i := 0; i < n; i++ {
		var x, y int
		fmt.Scanf("%d,%d", &x, &y)
		intersect[i] = [2]int{x, y}
	}

	for i := 0; i < w; i++ {
		numbers[i] = i + 1
	}

	for _, v := range intersect {
		swap(numbers, v[0], v[1])
	}

	for _, v := range numbers {
		fmt.Println(v)
	}
}

func swap(arr []int, x, y int) {
	tmp := arr[x-1]
	arr[x-1] = arr[y-1]
	arr[y-1] = tmp
}

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

#define swap(a,b) a^=b^=a^=b

using namespace std;

int main(){
    
    int w,n,a,b;
    cin >> w >> n;
    int *ans = new int(w+1);


    for(int i=0;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;
    }
    delete ans;
    
}

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

int w, n, l[31];

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

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

	scanf("%d", &W);
	scanf("%d", &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 <iostream>
#include <cstdio>
using namespace std;

int main(void) {
    int w, n;
    int* vertical;
    int a, b, tmp;
    
    cin >> w;
    vertical = new int[w + 1];
    for(int i = 0; i <= w; ++i) {
        vertical[i] = i;
    }
    cin >> n;
// scanfの""内に','を入れることで入力の仕方をa,bにすることが出来る。abはエラー
    for(int i = 0; i < n; ++i) {
        scanf("%d,%d", &a, &b);
        tmp         = vertical[a];
        vertical[a] = vertical[b];
        vertical[b] = tmp;
    }
    for(int i = 1; i <= w; ++i) {
        cout << vertical[i] << endl;
    }
}

C++: #include<iostream>
using namespace std;
int n;
int a[1000000];
int sum[1000000];
int main(int argc, char const *argv[])
{

	int tc[30];
	cin>>tc[30];
	int w,v;
	for (int i = 0; i < 30; ++i) tc[i] = i+1;
		for (int i = 0; i < v; ++i)
		{
			int a,b;
			cin>>a>>b;
			int c=tc[a-1];
			tc[a-1]=tc[b-1];
			tc[b-1];

		}
		for (int i = 0; i < a; ++i)
		{
			cout<<t[i]<<endl;
		}
		
		
			
		
	    		
}

C++: //============================================================================
// Name        : desk.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<stdio.h>
#include<iostream>
#include <algorithm>
using namespace std;
int main(){
int w,n;
cin>>w>>n; //w????¨???????n????????\?????????????????°
int N[w]; //???????????°
for(int i=0;i<w;i++){
	N[i]=i+1; //?¨??????°?????\???????§?
}
for(int i=0;i<n;i++){
	int a,b;
	char c;
	cin>>a>>c>>b; //char???,?????\????????¨
	swap(N[a-1],N[b-1]); //swap??§??´??\??\?????????
}
for(int i=0;i<w;i++){
	cout<<N[i]<<endl; //?????¨?????????
}
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>
#include <cmath>

int main(void)
{
  int w, n;

  std::cin >> w >> n;

  std::vector<int> base;
  for (int i = 0; i < w; i++) {
    base.push_back(i + 1);
  }

  for (int i = 0; i < n; i++) {
    int a, b;
    scanf_s("%d,%d", &a, &b);
    std::swap(base[a - 1], base[b - 1]);
  }

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

  return 0;
}

C++: // 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

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

	int w;
	cin >> w;
	vector<int> A;
	for(int i = 1; i <= w; i++)A.push_back(i);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		string a, b;
		for(int j = 0; j < (int)s.size(); j++){
			if(s[j] == ','){
				a = s.substr(0, j);
				b = s.substr(j + 1);
				break;
			}
		}
		int x = stoi(a), y = stoi(b);
		x--;
		y--;
		swap(A[x], A[y]);
	}
	for(int i = 0; i < w; i++)cout << A[i] << '\n';
	return 0;
}
// Write Here

C++: #include <iostream>
#include <stdlib.h>
#include <string>
#include <strstream>

using namespace std;

int main(int argc, char **argv)
{
	int n, w;
	int *goal, **line;
	string str, st1, st2;
	
	cin >> w;
	cin >> n;
	
	goal = (int *)calloc(w, sizeof(int));
	line = (int **)calloc(n, sizeof(int));
	for(int i = 0; i < n; i++){
		line[i] = (int *)calloc(2, sizeof(int));
		cin >> str;
		st1 = str[0];
		st2 = str[2];
		istrstream istr1(st1.data());
		istrstream istr2(st2.data());
		istr1 >> line[i][0];
		istr2 >> line[i][1];
	}
	
	for(int i = 1, tmp = 0; i <= w; i++){
		tmp = i;
		for(int j = 0; j < n; j++){
			if(tmp == line[j][0]){
				tmp = line[j][1];
			} else if(tmp == line[j][1]){
				tmp = line[j][0];
			}
		}
		goal[tmp-1] = i;
	}
	
	for(int i = 0; i < w; i++){
		cout << goal[i] << endl;
	}
	
	free(goal);
	for(int i = 0; i < n; i++){
		free(line[i]);
	}
	free(line);
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define rrep(i,n) for(int i = n-1;i >=0;i--)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 }, sum = 0, h, w;
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
int main() {
    int n, m; string s; cin >> n >> m; vector<int> v(n);
    rep(i, n) v[i] = i + 1;
    rep(i, m) {
        int a,b;char c;
        cin >> a >> c >> b;
        swap(v[a-1], v[b-1]);
    }for (int i : v) cout << i << endl;
}

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

using namespace std;

int w, n;

struct bar {
	int a, b;
};

vector <bar> v;
int order[35];

int main() {
	scanf("%d", &w);
	scanf("%d", &n);
	
	for (int i=0; i<n; i++) {
		bar r;
		scanf("%d, %d", &r.a, &r.b);
		v.push_back(r);
	}
	
	for (int i=1; i<=w; i++) {
		int s = i;
		for (int j=0; j<n; j++) {
			if (v[j].a==s) s = v[j].b;
			else if (v[j].b==s) s = v[j].a;
		}
		order[s] = i;
	}
	
	for (int i=1; i<=w; i++) cout << order[i] << endl;
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main() { 
  int n, w, a[31], ai, bi;  
  cin >> w >> n;
  for(int i=1; i<=w; i++) {
    a[i] = i;
  } 
  for(int i=0; i<n; i++) { 
    scanf("%d%*c%d",&ai, &bi); 
    swap(a[ai],a[bi]); 
  } 
  for(int i=1; i<=w; i++) { 
    cout << a[i] << endl; 
  }  
  return 0;
}

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

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

	return 0;
}