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

int main() {
	int w, n, a, b;
	char comma;
	int amida[31];
	for (int i = 1;i < 31;i++) amida[i] = i;
	cin >> w >> n;

	for (int i = 0;i < n;i++) {
		cin >> a >> comma >> b;
		swap(amida[a], amida[b]);
	}

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

	return 0;
}

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

using namespace std;

int main(){

	int w,n;
	cin >> w >> n;
	int line [w];

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

	char cmd[4];
	for(int i = 0; i < n; ++i){
		cin >> cmd;
		swap(line[cmd[0]-'0'-1], line[cmd[2]-'0'-1]);
	}

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

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int parse(string a){
int s=0;
for(char b:a){
	s*=10;
	s+=b-48;
}
return s;
}
vector<int>split(string a){
	vector<int>b;
	string c="";
	for(char d:a){
		if(d==','){b.push_back(parse(c));c="";}
		else c+=d;
	}
	b.push_back(parse(c));
	return b;
}
int main(){
	int a[30];
	int b,c;
	scanf("%d%d",&b,&c);
	for(int d=0;d<b;d++){
		a[d]=d;
	}
	for(int e=0;e<c;e++){
		string f;
		cin>>f;
		vector<int>g=split(f);
		int h=a[g[0]-1];
		a[g[0]-1]=a[g[1]-1];
		a[g[1]-1]=h;
	}
	for(int x=0;x<b;x++){
		printf("%d\n",a[x]+1);
	}
}

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<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int w,n,a,b;
	char o;
	cin>>w>>n;
	vector<int>c;
	for(int i=0;i<=w+1;i++)c.push_back(i);
	for(int i=1;i<=n;i++){
	cin>>a>>o>>b;
	swap(c[a],c[b]);
	}
	for(int i=1;i<=w;i++) cout<<c[i]<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)

int main(){
    int w, n;
    cin >> w >> n;
    vector<int> num(w, 0);
    int it = 1;
    for(int& k : num) k = it++;
    rep(i, n){
        string a;
        cin >> a;
        int p = a[0] - '1', q = a[2] - '1';
        swap(num[p], num[q]);
    }
    for(int k : num)
      cout << k << endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
int main (){
	int w,N,d[30],c[30];
	cin>>w>>N;
	for(int j=0;j<w;j++){
		d[j]=j+1;
		c[j]=d[j];
	}
	for(int i=0;i<N;i++){
		int a,b;
		cin>>a>>b;
		d[a]=d[b];
		d[b]=c[a];
		c[a]=d[a];
	}
	for(int k=0;k<w;k++){
	cout<<d[k]<<endl;
	}

	return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  int w, n;
  cin >> w >> n;
  int c[w];
  for (int i = 1; i <= w; i++)
    c[i-1] = i;

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

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

C++: #include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i < n; i++)
#define ll long long
#define EPS 1.0e-8
#define MAX_N 100
typedef pair<int,int> Pii;
typedef pair<int,int> Pis;
const double PI=acos(-1);

int main(){
	int w, n;
	int stage[w];
	int a, b;
	cin >> w >> n;
	rep(i,w) stage[i] = i+1;

	rep(i,n){
		scanf("%d,%d",&a,&b);	
		stage[a-1] ^= stage[b-1];
		stage[b-1] ^= stage[a-1];
		stage[a-1] ^= stage[b-1];
	}

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

C++: 

#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

const int MAX_HORIZONTAL = 30;
const int MAX_VERTICAL = 30;

int main(){

	int VerticalLines;
	int HorizontalLines;
	int HorizonA[MAX_HORIZONTAL];
	int HorizonB[MAX_HORIZONTAL];
	int Results[MAX_VERTICAL];



	cin >> VerticalLines;
	cin >> HorizontalLines;
	for (int i = 0; i < HorizontalLines; ++i){ char c[32];  scanf("%d,%d", &HorizonA[i], &HorizonB[i]); }

	for (int i = 0; i < VerticalLines; ++i){ Results[i] = i + 1; }

	

	for (int i = 0; i < HorizontalLines; ++i){
		int Swap = Results[HorizonA[i] - 1];
		Results[HorizonA[i]-1] = Results[HorizonB[i] - 1];
		Results[HorizonB[i] - 1] = Swap;
	}

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





	return 0;
}

C++: #include <cstdio>

void swap(int array[], int a, int b){
	int c = array[a];
	array[a] = array[b];
	array[b] = c;
}

int main(){
	int array[50];
	int w,n,a,b;

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

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
int main(){
    int w,n;
    cin >> w >> n;
    vector<int> vec;
    rep(i,w){
        vec.push_back(i+1);
    }
    rep(i,n){
        int a,b;
        scanf("%d,%d",&a,&b);
        a--; b--;
        //cout << a << " " << b << endl;;
        swap(vec[a],vec[b]);
    }
    rep(i,w) cout << vec[i] << endl;
    return 0;
}

C++: #include<iostream>

using namespace std;



int main(){
  int w=1,n=0;

  cin>>w>>n;
  int a_b[n][2];
  int out[n+1];//don't use out[0]
  for(int i=0;i<n;i++){
    cin>>a_b[i][0];
    cin.ignore();
    cin>>a_b[i][1];
  }
  
  for(int i=0; i<w; i++){
    int now=i+1;//I want to use out[] from 1 because now start 1
    for(int j=0; j<n; j++){
      if(a_b[j][0]==now)now = a_b[j][1];
      else if(a_b[j][1]==now)now = a_b[j][0];
     
    }
    out[now]=i+1;
  }
  for(int i=1;i<=w; i++){
    cout<<out[i]<<endl;
  }

}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

int a[100];

int main(){
	int w,n;
	cin>>w>>n;
	rep(i,w)a[i]=i+1;
	rep(i,n){
		int x,y;
		scanf("%d,%d",&x,&y);
		int t=a[x-1];
		a[x-1]=a[y-1];
		a[y-1]=t;
	}
	rep(i,w)cout<<a[i]<<endl;
	return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
	int w, n;
	cin >> w;
	cin >> n;
	int *array = new int[w + 1];
	for (int i = 1; i < w + 1; i++) {
		array[i] = i;
	}
	for (int i = 1; i < n+1; i++) {
		int a, b;
		char c;
		cin >> a >> c >> b;
		int tmp;
		tmp = array[a];
		array[a] = array[b];
		array[b] = tmp;
	}
	for (int i = 1; i < w + 1; i++) {
		cout << array[i] << endl;
	}
	return 0;
}