Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	w := nextInt()
	n := nextInt()

	numbers := make([]int, w+1)
	for i := 1; i <= w; i++ {
		numbers[i] = i
	}

	for i := 0; i < n; i++ {
		line := nextString()
		words := strings.Split(line, ",")
		a, _ := strconv.Atoi(words[0])
		b, _ := strconv.Atoi(words[1])

		numbers[a], numbers[b] = numbers[b], numbers[a]
	}

	for i := 1; i <= w; i++ {
		fmt.Println(numbers[i])
	}
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int w,n;
string stick[31];
string stick2[31];
string num[31]={"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
vector<pair<string,string> > pii;
int main(){
  cin>>w>>n;
  for(int i=1;i<=w;i++){
    if(i>=1&&i<=9)
      stick[i-1]=i+'0';
    else if(i>=10&&i<=99){
      stick[i-1]=(i/10)+'0';
      stick[i-1]+=(i%10)+'0';
    }
  }
  for(int i=0;i<n;i++){
    string a,b,c;
    cin>>a;
    for(int j=0;j<a.size();j++){
      if(a[j]==','){
	b=a.substr(0,j);
	c=a.substr(j+1,a.size()-b.size()-1);
      }
    }
    pii.push_back(make_pair(b,c));
  }
  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=0;j<w;j++){
      if(stick[i]==num[j]){
	stick2[j]=i+'1';
	break;
      }
    }
  }
  for(int i=0;i<w;i++)
    cout<<stick2[i]<<endl;
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    // default
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
    cin.ignore(INT_MAX, '\n');
    for (int i = 0; i < n; ++i) {

    }
    for (int i = 0; i < vec.size(); ++i) {
      cout << vec[i] << endl;
    }
  } // while loop out
  return 0;
}

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