Go: package main

import "fmt"

func main() {
	var w, n int
	fmt.Scan(&w)
	numbers := make([]int, w)

	fmt.Scan(&n)

	intersect := make([][2]int, n)

	for i := 0; i < n; i++ {
		var x, y int
		fmt.Scanf("%d,%d", &x, &y)
		intersect[i] = [2]int{x, y}
	}

	for i := 0; i < w; i++ {
		numbers[i] = i + 1
	}

	for _, v := range intersect {
		swap(numbers, v[0], v[1])
	}

	for _, v := range numbers {
		fmt.Println(v)
	}
}

func swap(arr []int, x, y int) {
	tmp := arr[x-1]
	arr[x-1] = arr[y-1]
	arr[y-1] = tmp
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int w,n,b,c;
  cin>>w>>n;
  int a[w];
  for(int i=0;i<w;i++){
    a[i]=i+1;
  }
  for(int i=0;i<n;i++){
    scanf("%d,%d",&b,&c);
    int temp=a[b-1];
    a[b-1]=a[c-1];
    a[c-1]=temp;
  }
  for(int j=0;j<w;j++)cout<<a[j]<<endl;
}

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

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[5];
    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++: #include <iostream>
#include <vector>
using namespace std;

int main(){
  vector<int> a;
  int w,n,s1,s2;
  char c;
  cin >> w >> n;
  for(int i=1;i<=w;i++)a.push_back(i);
  for(int i=0;i<n;i++){
	cin >> s1 >> c >> s2;
	swap(a[s1-1],a[s2-1]);
  }
  for(auto i:a)cout << i << endl;
  return 0;
}

C++: #include<stdio.h>

int main()
{
    int a,b,c,d;
    int x[30],y,z[30];
    scanf("%d%d",&a,&b);
    for(int i = 0; i < a; i++)
    {
        x[i]=i+1;
    }
    for(int i = 0; i < b; i++)
    {
        scanf("%d,%d",&c,&d);
        y = x[c-1];
        x[c-1] = x[d-1];
        x[d-1] = y;
    }
    for(int i = 0; i < a; i++)
    {
        printf("%d\n",x[i]);
    }
    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) {
      string str, tmp_a, tmp_b;
      int a, b;
      getline(cin, str);
      istringstream iss(str);
      getline(iss, tmp_a, ',');
      getline(iss, tmp_b, ',');
      a = stoi(tmp_a) - 1;
      b = stoi(tmp_b) - 1;
      int tmp = vec[a];
      vec[a] = vec[b];
      vec[b] = tmp;
    }
    for (int i = 0; i < vec.size(); ++i) {
      cout << vec[i] << endl;
    }
  } // while loop out
  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int w, n;
    cin >> w >> n;
    VI a(w);
    REP(i,w) a[i] = i+1;
    while (n--){
        int x, y;
        scanf("%d,%d", &x, &y);
        swap(a[x-1], a[y-1]);
    }
    REP(i,w) cout << a[i] << endl;

    return 0;
}

C++: #include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
void getValues(string& s, int& a, int & b)
{
	string::size_type p = s.find(',');
	string sa = s.substr(0, p);
	string sb = s.substr(p + 1);
	a = atoi(sa.c_str());
	b = atoi(sb.c_str());
}

int main()
{
	int w, n, a, b;
	cin >> w >> n;
	int W[31] = {};
	FOR(i, 1, w + 1) W[i] = i;
	string line;
	while (n--){
		cin >> line;
		getValues(line, a, b);
		swap(W[a], W[b]);
	}
	FOR(i, 1, w + 1) cout << W[i] << "\n";
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;


int main()
{
    int w,n;
    cin>>w>>n;
    vector<int> act(w);
    for(int c=0;c<act.size();c++) act[c]=c+1;
    for(int c=0;c<n;c++)
    {
        string s;
        cin>>s;
        int a=0,b=0;
        int c2;
        for(c2=0;s[c2]!=',';c2++) {a*=10;a+=s[c2]-'0';}
        c2++;
        for(;c2<s.size();c2++) {b*=10;b+=s[c2]-'0';}

        swap(act[a-1],act[b-1]);
    }
    for(int c=0;c<w;c++) cout<<act[c]<<endl;
}

C++: 
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<stdio.h>
using namespace std;
const int MAX = 100;
int main() {
	int W, N;
	int t[MAX];

	cin >> W >> N;
	for (int i = 0; i < W; i++) {
		t[i] = i;
	}
	for (int i = 0; i < N; i++) {
		int a, b;
		scanf("%d,%d", &a, &b); a--; b--;
		swap(t[a], t[b]);
	}
	for (int i = 0; i < W; i++) {
		printf("%d\n", t[i] + 1);
	}
	return 0;
}

C++: #include <iostream>

const int W_MAX = 30;
const int N_MAX = 30;

int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];

void chenge(int *farst, int *second){
	int tmp;
	tmp = *farst;
	*farst = *second;
	*second = tmp;
}

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

	std::cin >> w;
	std::cin >> n;

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

	for(int i = 1; i <= n; i++){
		std::cin >> a[i] >> b[i];
		chenge(&out[a[i]], &out[b[i]]);
	}
	
	for(int i = 1; i <= w; i++){
		std::cout << out[i] << '\n';
	}

	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 = 3;
    for (int i = 0; i < n; ++i) {

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

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

int main() {
	int w; std::cin >> w;
	int W[w];
	for (int i=0; i<w; i++) W[i] = i+1;
	int n; std::cin >> n;
	int a, b, tmp;
	while (~scanf("%d,%d", &a, &b)) {
		tmp = W[a-1];
		W[a-1] = W[b-1];
		W[b-1] = tmp;
	}
	for (int i=0; i<w; i++) std::cout << W[i] << std::endl;
	return 0;
}

C++: #include<iostream>

int main(){
	int w,n,tate[31],yoko1,yoko2,i,j;
	char c;

	
	std::cin>>w>>n;
	for(i=1;i<=w;i++){
		tate[i]=i;
	}

	for(i=0;i<n;i++){
		std::cin>>yoko1>>c>>yoko2;
		j=tate[yoko1];
		tate[yoko1]=tate[yoko2];
		tate[yoko2]=j;
	}

	for(i=1;i<=w;i++){
		std::cout<<tate[i]<<std::endl;
	}

		
	
	
  return 0;
}

C++: #include <stdio.h>

using namespace std;

int main(){
    int w, n;
    int d[31];
    char s[30];
    while(~scanf("%d %d", &w, &n)){
        for(int i=1;i<=w;i++) d[i] = i;
        for(int i=0;i<n;i++){
            scanf("%s", s);
            int a, b;
            sscanf(s, "%d,%d", &a, &b);
            swap(d[a], d[b]);
        }
        for(int i=1;i<=w;i++) cout << d[i] << endl;
    }
}