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>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
char temp;

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>
#include <cmath>
#include <cstdio>

int main(void)
{
  int w, n;

  std::cin >> w >> n;

  std::vector<int> base;
  for (int i = 0; i < w; i++) {
    base.push_back(i + 1);
  }

  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d,%d", &a, &b);
    std::swap(base[a - 1], base[b - 1]);
  }

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

  return 0;
}

C++: //
//  main.cpp
//  CppTest
//
//  Created by Ryu on 2017/02/08.
//  Copyright ?? 2017??´ Ryu. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int w = 0;
    cin >> w;
    
    int n = 0;
    cin >> n;
    
    int c[w];
    for(int i = 0; i < w; i++){
        c[i] = i + 1;
    }
    
    int a, b;
    int buffer;
    for (int i = 0; i < n; i++) {
        scanf("%d,%*d",&a, &b);
        //printf("a: %d, b: %d ;; ", a, b);
        //printf("%d, %d -> ", c[a - 1], c[b - 1]);
        buffer = c[a - 1];
        c[a - 1] = c[b - 1];
        c[b - 1] = buffer;
        //printf("%d, %d\n", c[a - 1], c[b - 1]);
    }
    for (int i = 0; i < w; i++) {
        printf("%d\n", c[i]);
    }
    
    
    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;
	}

	for(int t=0; t<n; t++){
		int a, b;
		char c;
		cin >> a >> c >> b;
		swap(s[a-1], s[b-1]);
	}

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

	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

int main()
{ 
	int w, n;
	cin >> w;
	cin >> n;

	vector<int> s(w);
	for (int i = 1; i <= w; ++i)
		s[i] = i;

	while (n--)
	{
		int a, b;
		scanf("%d,%d", &a, &b);

		swap(s[a], s[b]);
	}

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

	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main() {
  int w, n;
  cin >> w >> n;
  vector<int> vec;
  vec.resize(w);
  for (int i = 0; i < vec.size(); ++i) {
    vec[i] = i + 1;
  }
  int a, b;
  for (int i = 0; i < n; ++i) {
    scanf("%d,%d", &a, &b);
    a -= 1;
    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;
  }
  return 0;
}

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

int main()
{
	int w, n;
	cin >> w;
	int* num = new int[w];
	for (int i = 0; i < w; i++) {
		num[i] = i + 1;
	}
	for (cin >> n; n--;) {
		int a, b;
		char c;
		cin >> a >> c >> b;
		int tmp = num[a - 1];
		num[a - 1] = num[b - 1];
		num[b - 1] = tmp;
	}
	for (int i = 0; i < w; i++) {
		cout << num[i] << endl;
	}
	return 0;
}

C++: #include <iostream>

int main()
{
        int n, w;
        std::cin >> w >> n;
        
        int num[w], t, a, b;
        char c;

        for(t = 0; t < w ; ++t)
                num[t] = t + 1;

        while(n--)
        {
                std::cin >> a >> c >> b;
                t = num[a - 1];
                num[a - 1] = num[b - 1];
                num[b - 1] = t;
        }

        for(t = 0; t < w; ++t)
                std::cout << num[t] << std::endl;

        return 0;
}

C++: #include <stdio.h>

int main()
{
int p[31]={0};
int w,n,a,b;
char e;
int tmp;
tmp=0;
scanf("%d",&w);scanf("%d",&n);
for(int i=0;i<w;i++)
p[i]=i+1;
for(int i=0;i<n;i++)
{
scanf("%d,%d",&a,&b);
tmp=p[a-1];p[a-1]=p[b-1];p[b-1]=tmp;

}

for(int i=0;i<w;i++)
printf("%d\n",p[i]);

return 0;
}

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

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)  //a~(b - 1)?????§
#define print(i) cout << i << endl //?°??????????Python?????????
#define all(i) (i).begin(),(i).end() //??¨??????(sort??¨???)
#define mp make_pair //mp(OO, OO)??¨???:::pint??¨???

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/

int main(void)
{
  int w, n, a, b; cin >> w >> n;
  int x[35];
  FOR(i, 0, w + 1) x[i] = i;

  FOR(i, 0, n){
    scanf("%d,%d", &a, &b);
    swap(x[a], x[b]);
  } 

  FOR(i, 1, w + 1) cout << x[i] << endl;

  return 0;
}

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

int main()
{
    int n,w;
    int a,b;
    int yoko_1[100],yoko_2[100];
    int ans[100];
    char ch;
    
    cin>>w>>n;
    
    for (int i=0; i<n; i++) {
        cin>>a>>ch>>b;
        yoko_1[i]=a;
        yoko_2[i]=b;
    }
    
    int i=0,yoko=1,count=1;
    
    while (1) {
        if (yoko_1[i] == yoko) {
            yoko = yoko_2[i];
            i++;
        }
        else if(yoko_2[i] == yoko){
            yoko = yoko_1[i];
            i++;
        }
        else{
            i++;
        }
        if (w==i) {
            ans[yoko-1]=count;
            i=0;
            count++;
            yoko=count;
        }
        if(count>w){
            break;
        }
    }
    for (int i=0; i<w; i++) {
        cout<<ans[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);
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
    cin.clear();
    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;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
int main()
{
    int w, n;
    cin >> w >> n;
    vector<int> num(w);
    for(int i=0; i<w; ++i)
        num[i] = i+1;
 
    for(int i=0; i<n; ++i){
        int a, b;
        char c;
        cin >> a >> c >> b;
        swap(num[a-1], num[b-1]);
    }
 
    for(int i=0; i<w; ++i)
        cout << num[i] << endl;
 
    return 0;
}