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

int main(){
  int tate,yoko,a,b,m[31];
  char c;
  cin>>tate;
  for(int i=1;i<=tate;i++)
    m[i]=i;
  cin>>yoko;
  for(int i=0;i<yoko;i++){
    cin>>a>>c>>b;
    swap(m[a],m[b]);
  }
  for(int i=1;i<=tate;i++)
    cout<<m[i]<<endl;
  return 0;
}

C++: #include<stdio.h>
int main(void){
	int w,n,x,y,temp;
	int a[31];
	char str[7];
	for(int i = 0; i < 31; i++){
		a[i] = i;
	}
	scanf("%d %d",&w,&n);
	for(int i = 0; i < n; i++){
		getline(str,6);
		if(str[3] == ',')
			str[3] = ' ';
		else
			str[2] = ' ';
		sscanf(str,"%d %d",&x,&y);
		temp = a[x];
		a[x] = a[y];
		a[y] = temp;
	}

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

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

using std::cin;

int main()
{
    int vert_num;
    cin >> vert_num;
    std::vector<int> vert(vert_num);

    for (auto i = 0; i < vert_num; i++) {
        vert.at(i) =  i + 1;
    }

    int horiz;
    cin >> horiz;

    while (horiz--) {
        int swap1, swap2;
        char x;
        cin >> swap1 >> x >> swap2;

        int tmp = vert.at(swap1 - 1);
        vert.at(swap1 - 1) = vert.at(swap2 - 1);
        vert.at(swap2 - 1) = tmp;
    }

    for (auto i = 0; i < vert_num; i++) {
        std::cout << vert.at(i) << std::endl;
    }

    return 0;
}

C++: #include <iostream>
#include<cstdio>
#include<vector>
using namespace std;
#define ARRAY_MAX 50

int main(){
	// your code goes here
  int vertical,horizontal;
  int tmp;
  int array[ARRAY_MAX][ARRAY_MAX];
  int num[ARRAY_MAX];
  char c;

  cin >> vertical >> horizontal;

  for(int i = 0;i < vertical;i++){
    num[i] = i+1;
  }

  for(int i = 0;i < horizontal;i++){
    cin >> array[i][0] >> c >> array[i][1];
  }
  
 
  for(int i = 0;i < vertical;i++){
    tmp = num[array[i][0]-1];
    num[array[i][0]-1] = num[array[i][1]-1];
    num[array[i][1]-1] = tmp;
  }

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

C++: #include <bits/stdc++.h>
using namespace std;
 
int main() {
  int amida[31];
  for ( int i = 0; i < 31; i++ ) amida[i] = i;
  int w,n; cin >> w >> n;
  for ( int i = 0; i < n; i++ ) {
    int a,b; char ch;
    cin >> a >> ch >> b;
    swap(amida[a],amida[b]);
  }
  for ( int i = 1; i <= w; i++ ) cout << amida[i] << endl;;
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
using namespace std;
int w,n;
int stick[50],stick2[50]={0};
vector<pair<int,int> > pii;
int main(){
  cin>>w>>n;
  for(int i=1;i<=w;i++)
    stick[i-1]=i;
  for(int i=0;i<n;i++){
    string a;
    cin>>a;
    pii.push_back(make_pair(a[0]-'0',a[2]-'0'));
    }
  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=1;j<=w;j++){
      if(stick[i]==j){
	stick2[j-1]=i+1;
	break;
      }
    }
  }
  for(int i=0;i<w;i++)
    cout<<stick2[i]<<endl;
  return 0;
}

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

using namespace std;

int main(){

	int w,n,left,right;
	scanf("%d",&w);
	int array[w+1];
	for(int i=0;i<w+1;i++)array[i]=i;
	scanf("%d",&n);

	for(int i=0;i<n;i++){
		scanf("%d,%d",&left,&right);
		swap(array[left],array[right]);
	}

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

    return 0;
}

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

int main(){
  int w, n;

  cin >> w >> n;

  int t[w];

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

  //ツ禿シツ療債つウツづェツつスツ渉?氾板づ可スツδ渉ッツプツ堕?催ャツづーツ行ツつヲツづ篠つ「ツつ「
  for(int i = 0; i < n; i++){
    int a, b;
    char ch;

    cin >> a >> ch >> b;
    swap(t[a - 1], t[b - 1]); //swapツ甘鳴青板づーツ使ツつヲツづ篠配ツ療アツ禿?づ個要ツ素ツづーツ甘按単ツづ可禿シツづェツ妥鳴つヲツづ?つォツづゥ
  }

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

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

int main(){

  int w, n, a, b, p[30], tmp;

  cin >> w >> n;

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

  for(int i=1; i<=n; i++){
    scanf("%d,%d", &a, &b);
    tmp = p[a];
    p[a] = p[b];
    p[b] = tmp;
  }

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

  return 0;

}

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

int main(){
vector<int>v;
int w,n;
int a,b;
char m;
cin>>w>>n;
for(int i=0;i<w;i++){
	v.push_back(i+1);
	}
	
	for(int i=0;i<n;i++){
cin>>a>>m>>b;
		int c=v[a];
		v[a]=v[b];
		v[b]=c;
		}
		
		for(int i=0;i<w;i++){
			cout<<v[i]<<endl;
			}
			
		return 0;
		
		}

C++: //0011
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

int main(){
	int w,h;
	char dummy;
	std::cin>>w>>h;
	std::vector<int> vec(w);
	for(int i=0;i<w;++i)vec[i]=i+1;
	for(int i=0;i<h;i++){
		int a, b;
		std::cin>>a>>dummy>>b;
		{
			using std::swap;
			swap(vec[a-1],vec[b-1]);
		}
	}
	for(int i=0;i<w;i++){
		std::cout<<vec[i]<<std::endl;
	}
	return 0;
}

C++: #include<iostream>
 
using namespace std;
 
int main(){
  int lot[31];
  for(int i=1;i<=30;i++){
    lot[i]=i;
  }
  int w,n;
  cin>>w>>n;
  for(int i=0;i<n;i++){
    int a,b;
    (cin>>a).ignore()>>b;
    swap(lot[a],lot[b]);
  }
  for(int i=1;i<=w;i++){
    cout<<lot[i]<<endl;
  }
  return 0;
}

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

int main() {
	int w,n;
	cin>>w;
	cin>>n;
	int a[n];
	int b[n];
	char s[n];
	for(int i=0;i<n;i++){
		cin>>a[i]>>s[i]>>b[i];
	}
	int x[n+1];
	for(int i=1;i<=w;i++){
		x[i]=i;
		for(int j=0;j<n;j++){
			if(x[i]==a[j]){
				x[i]=b[j];
			}else if(x[i]==b[j]){
				x[i]=a[j];
			}
		}
	}
	for(int i=1;i<=w;i++){
		for(int j=1;j<=w;j++){
			if(x[j]==i){
				cout<<j<<endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>

using namespace std;
vector<string> split(string s, char del = ' '){
  vector<string> res;
  replace(s.begin(),s.end(),del,' ');
  stringstream ss(s);
  string elem;
  for(int i=0; ss >> elem; i++){
    res.push_back(elem);
  }
  return res;
}

int main(){
  int vl, hl;
  string s;

  cin >> vl;
  cin >> hl;

  int lines[vl];
  for(int i=0; i<vl; i++){
    lines[i] = i+1;
  }

  int a, b, k;
  cin.ignore();
  for(int j=0; j<hl; j++){
    getline(cin,s);
    vector<string> str = split(s,',');
    a = atoi(str[0].c_str());
    b = atoi(str[1].c_str());

    k = lines[a-1];
    lines[a-1] = lines[b-1];
    lines[b-1] = k;
  }

  for(int m=0; m<vl; m++){
    cout << lines[m] << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    int w, n, a, b, t;
	char c;
	cin >> w >> n;
	
	vector<int> tate;
	
	for(int i=1;i<=w;i++){
		tate.push_back(i);
	}
	
	for(int i=0;i<n;i++){
		cin >> a >> c >> b;
		t = tate[a-1];
		tate[a-1]=tate[b-1];
		tate[b-1]=t;
	}
	
	for(int i=0;i<w;i++){
		cout << tate[i] << endl;
	}
	
	return 0;
}