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 <stdio.h>
#include <stack>
using namespace std;

int main(){
	int amida[30][2];
	int n, m;// ??°??¨?????\????????°
	cin >> n >> m;
	for (int i = 0; i < m; i++)scanf("%d,%d",&amida[i][0],&amida[i][1]);

	for (int i = 0; i < n; i++) {
		int Now=i+1;
		for (int j = m - 1; j >= 0; j--) {
			if (amida[j][0] == Now) {
				Now = amida[j][1];
			}
			else if (amida[j][1] == Now) {
				Now = amida[j][0];
			}
		}
		printf("%d\n",Now);
	}
	return 0;
}

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int w,n;
string stick[31];
string stick2[31];
string num[31]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
vector<pair<string,string> > pii;
int main(){
  cin>>w>>n;
  for(int i=1;i<=w;i++){
    if(i>=1&&i<=9)
      stick[i-1]=i+'0';
    else if(i>=10&&i<=99){
      stick[i-1]=(i/10)+'0';
      stick[i-1]+=(i%10)+'0';
    }
  }
  for(int i=0;i<n;i++){
    string a,b,c;
    cin>>a;
    for(int j=0;j<a.size();j++){
      if(a[j]==','){
	b=a.substr(0,j);
	c=a.substr(j+1,a.size()-b.size()-1);
      }
    }
    pii.push_back(make_pair(b,c));
  }
  for(int i=0;i<w;i++){
     for(int j=0;j<n;j++){
    if(stick[i]==pii[j].first)
      stick[i]=pii[j].second;
    else if(stick[i]==pii[j].second)
      stick[i]=pii[j].first;
     }
  }
  for(int i=0;i<w;i++){
    for(int j=0;j<w;j++){
      if(stick[i]==num[j]){
	stick2[j]=i+'1';
	break;
      }
    }
  }
  for(int i=0;i<w;i++)
    cout<<stick2[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);
    // 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) {

    }
    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(){
	int w, n;
	cin >> w >> n;
	int s[w];

	for(int i=0; i<w; i++)s[i] = i+1;

		while(n--){
		int a, b, c;
		cin >> a >> b;

		int tmp = s[a-1];
		s[a-1] = s[b-1];
		s[b-1] = tmp;
	}

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

C++: #include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int w,n;

int main(){
    cin >> w >> n;
    vector<int> a(n),b(n);
    rep(i,n) scanf("%d,%d",&a[i],&b[i]),a[i]--,b[i]--;

    vector<int> number(w);
    iota(number.begin(),number.end(),1);
    rep(i,n) swap(number[a[i]],number[b[i]]);

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

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


int main(){
	int stick[40];
	int n,q;
	string pair;
	cin>>n;
	for(int i=0;i<n;i++){
		stick[i]=i+1;
	}
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>pair;
		swap(stick[pair[0]-'0'-1],stick[pair[2]-'0'-1]);
	}
	for(int i=0;i<n;i++){
		cout<<stick[i]<<endl;
	}
}

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

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
int a[100000], w, n, x, y, h, p;
string o;
int main(){
	cin >> w >> n;
	for(int i = 1; i <= w; i++){
		a[i] = i;
	}
	for(int i = 1; i <= n; i++){
		x = 0;
		y = 0;
		cin >> o;
		p = o.find(',');
		for(int i = 0; i < p; i++){
			x *= 10;
			x += (int)o[i] - '0';
		}
		for(int i = p+1; i < o.length(); i++){
			y *= 10;
			y += (int)o[i] - '0';
		}
		h = a[y];
		a[y] = a[x];
		a[x] = h;
	}
	for(int i = 1; i <= w; i++){
		cout << a[i] << "\n";
	}
	return 0;
}

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

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

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

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>
using namespace std;

int main(){
	int w[31]={0};
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){//1ツ氾板つゥツづァツ棒ツづ個青板づ慊づ渉可甘コツ可サ
		w[i-1]=i;
	}
	int a,b,t,ww;
	cin>>ww;
	for(int i=1;i<=ww;i++){
	cin>>a>>b;
	t=w[b];
	w[b]=w[a];
	w[a]=t;
	}
	for(int i=1;i<=n;i++){
		cout<<w[i-1]<<endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int w,n;
	int d[100],e[100];
	int a[100];
	char c;
	cin>>w>>n;
	for(int i=0;i<n;i++)
		cin>>d[i]>>c>>e[i];
	for(int i=1;i<=w;i++)
		a[i]=i;
	for(int j=0;j<n;j++){
		int tmp=a[d[j]];
		a[d[j]]=a[e[j]];
		a[e[j]]=tmp;
	}
	for(int i=1;i<=w;i++)
		cout<<a[i]<<endl;
	return 0;
}