Go: package main

import (
        "fmt"
)

const MAX_N = 31
var lines [MAX_N]int

func main() {
        var n, w int
        fmt.Scanf("%d", &n)
        fmt.Scanf("%d", &w)

        Init()
        var l, r int
        for {
                _, err := fmt.Scanf("%d,%d", &l, &r)
                if err != nil {
                        break
                }

                Swp(l, r)
        }

        for i := 1; i <= n; i++ {
                fmt.Printf("%d\n", lines[i])
        }
}

func Swp(l int, r int) {
        var s int
        s = lines[l]
        lines[l] = lines[r]
        lines[r] = s
}

func Init() {
        for i := 0; i < MAX_N; i++ {
                lines[i] = i
        }
}

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

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<sstream>
using namespace std;

	int stoi(string a){
		int b;
		stringstream ss;
		ss<<a;
		ss>>b;
		return b;
	}
	string itos(int a){
		stringstream ss;
		ss >>a;
		string b;
		b=ss.str();
		return b;
	}

int main(){
	int w,n,ans[40]={0};
	cin>>w>>n;
	for(int i=0;i<40;i++)ans[i]=i+1;
	for(int i=0;i<n;i++){
		string a,maes,usis;int kan,mae,usiro;
		cin>>a;
		kan=a.find(',');
		maes=a.substr(0,kan);
		usis=a.substr(kan+1,a.size()-kan);
		mae=stoi(maes);
		usiro=stoi(usis);
		swap(ans[mae-1],ans[usiro-1]);
	}
	for(int i=0;i<w;i++)cout<<ans[i]<<endl;
    return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


int main(){
	ios::sync_with_stdio(false);

	int w, n;
	int a, b;
	char s;

	cin >> w;
	cin >> n;

	vi bar(w);

	REP(i, w)
		bar[i] = i + 1;

	while (n!=0){
		cin >> a >> s >> b;



		swap(bar[a - 1], bar[b - 1]);
		n--;
	}

	REP(i, w)
		printf("%d\n", bar[i]);
}

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

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[len];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[len];
    for(int i = 0; i < len; i++){
        array[i] = i+1;
    }
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

C++: w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]