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>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

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

    int vertical;
    int horizon;
    
    cin >> vertical;
    cin >> horizon;
    
    vector<int> numbers;
    REP(i, 0, vertical) {
        numbers.push_back(i+1);
    }
    
    REP(i, 0, horizon) {
        int sa, sb;
        char comm;
        cin >> sa >> comm >> sb;
        swap(numbers[sa-1], numbers[sb-1]);
    }

    REP(i, 0, vertical) {
        cout << numbers.at(i) << endl;
    }

    return 0;
}

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

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

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

int main(){
	int w, n, i, tmp, a, b;
	cin>>w;
	cin>>n;
	vector<int> vw(w);
	vector<vector<int> > vn(n, vector<int>(2));
	for(i=0;i<w;i++) vw[i] = i+1;
	for(i=0;i<n;i++){
		scanf("%2d,%2d",&a, &b);
		vn[i][0] = a-1;
		vn[i][1] = b-1;
		
		tmp = vw[(vn[i][0])];
		vw[(vn[i][0])] = vw[(vn[i][1])];
		vw[(vn[i][1])] = tmp;
	}
	for(i=0;i<w;i++) cout << vw[i] << endl;
	return 0;
}

C++: #include<iostream>

int main(){
	
	char a;
	int w,n,tate[30],b,c,d,i;

	std::cin>>w;
	for(i=1;i<=w;i++){
		tate[i]=i;
		}
	std::cin>>n;
	
	for(i=0;i<n;i++){
		std::cin>>b>>a>>c;
		d=tate[b];
		tate[b]=tate[c];
		tate[c]=d;
		}
		
	for(i=1;i<=w;i++){
		std::cout<<tate[i]<<std::endl;
		}

	return 0;
	
	}

C++: #include<iostream>
#include<vector>
#include<string>
int main(){
	int w,h;
	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++){
		std::string str;
		std::cin>>str;
		{
			char c=str[0],d=str[2];
			int a=c-'0'-1,b=d-'0'-1;
			int n=vec[a];
			vec[a]=vec[b];
			vec[b]=n;
		}
	}
	for(int i=0;i<w;i++){
		std::cout<<vec[i]<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <functional>

#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define ll long long

using namespace std;


int main(void) {
    int n,w;
    string str;
    cin >> n >> w;
    vector<int> v(n);
    REP(i,n){
        v[i]=i+1;
    }
    REP(i,w){
        cin >> str;
        int a,b;
        a=str[0]-'0';
        b=str[2]-'0';
        REP(k,n){
            REP(l,n){
                if (v[k]==a && v[l]==b){
                    v[k] = b;
                    v[l] = a;
                    goto hoge;
                }
            }
        }
    hoge:;
    }
    vector<pair<int,int> > vp(n);
    REP(i,n){
        vp[i].first=v[i];
        vp[i].second=i+1;
    }
    sort(vp.begin(),vp.end());
    
    REP(i,n) cout << vp[i].second << endl;
    return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: 
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0011&lang=jp

#include <algorithm>
#include <iostream>
#include <vector>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <math.h>
#include <iomanip>
#include <sstream>

using namespace std;

//テ」ツδ榲」ツつッテ」ツδュテ・ツョツ堙ァツセツゥ
#define ALL(v) (v).begin(),(v).end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define REP(i,a,b) for(int i=(int)(a); i<(int)(b); ++i)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define SORT(x) sort(begin(x),end(x))
#define SELECT_SORT(x, n) sort(begin(x),begin(x)+n)
#define SWAP(type, a, b) do {type tmp = a; a = b; b = tmp;} while (0)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))

//テ・ツョツ堙ヲツ閉ー
#define INF 2000000000000
#define MAX 10

//DEBUGテァツ板ィ
#define BAR() cout << "----------------------------" << endl;
#define DUMP(v) (cerr << #v << ": " << v << endl)
#define PRINT(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

vector<int> amida;


int main()
{
	int w=0;
	cin >> w;
	amida.push_back(0);
	REP(i,1,w+1){
		amida.push_back(i);
	}
	
	int n=0;
	cin >> n;
	int a,b=0;
	while(n){
		scanf("%d,%d",&a,&b);
		SWAP(int, amida[a], amida[b]);
		n--;
	}
	
	REP(i,1,w+1){
		cout << amida[i] << endl;
	}
	
}

C++: #include <stdio.h>

int main(void){
  int w=0, n=0;
  int a[30], b[30], c[30];
  int i, j, tmp;

  scanf("%d", &w);
  scanf("%d", &n);

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

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

 /*
  printf("test----------\n");

  for (i=0; i<n; i++){
  	tmp = c[a[i]-1];
    c[a[i]-1] = c[b[i]-1];
    c[b[i]-1] = tmp;
    for (j=0; j<w; j++) {
  	  printf("%d ", c[j]);
    }
    printf("\n");
  } */

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

  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int w, n;
  cin >> w >> n;

  int p[30];
  iota(p, p + w, 0);
  for (int i = 0; i < n; i++) {
    int a, b;
    char c;
    cin >> a >> c >> b;
    swap(p[a - 1], p[b - 1]);
  }
  for (int i = 0; i < w; i++) {
    cout << p[i] + 1 << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
    int A[50];
   string s;
   int w,n;
    A[0]=0;
   while(cin>>w>>n)
   {
        for(int i=1;i<=w;i++)
       {
           A[i]=i;
       }
       while(n--)
       {

       cin>>s;
       int len=s.length();
       int d=s.find(',',0);
       string a=s.substr(0,d);
       string b=s.substr(d+1,len-1);
       int c=atoi(a.c_str());
       int e=atoi(b.c_str());
      // cout<<a<<endl<<b<<endl<<c<<endl<<e<<endl;
         int h= A[c];
         A[c]=A[e];
         A[e]=h;

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

C++: #include<stdio.h>
int main()
{
  int n,m,i;
  int line[101];
  int a,b;
  scanf("%d",&n);

  for(i = 1;i <= n;i++)line[i] = i;

  scanf("%d",&m);

  for(i = 0;i < m;i++){
    scanf(" %d %d",&a,&b);
    int temp = line[a];
    line[a] = line[b];
    line[b] = temp;
  }
  
  for(i = 1;i <= n;i++)printf("%d ",line[i]);
  printf("\n");
}