Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}

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

C++: #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main(){
    int s[100],n,i,a,b,k;
    char c;
    
    cin>>k>>n;
    
    for(i=1;i<=k;i++){
        s[i]=i;
    }
        
    for(i=0;i<n;i++){
        cin>>a>>c>>b;                 
        swap(s[a],s[b]);
    }
    for(i=1;i<=k;i++){
        cout<<s[i]<<endl;
    }
    return 0;
}

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