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

C++: ude <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(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] << ' ';
	}

	std::cout << '/n';

	return 0;
}

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

int main()
{
	int w, n, wn[30];

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

C++: #include <iostream>

using namespace std;

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

    int lot[w + 1][n];
    fill(lot[0], lot[w + 1], 0);

    int a, b;
    char c;
    for (int i = 0; i < n; i++) {
        cin >> a >> c >> b;
        lot[a][i] = b;
        lot[b][i] = a;
    }

    int ans[w + 1];
    for (int i = 1; i <= w; i++) {
        int i_ = i;
        for (int j = 0; j < n; j++) {
            if (lot[i_][j] != 0) i_ = lot[i_][j];
        }
        ans[i_] = i;
    }
    for (int i = 1; i <= w; i++) {
        cout << ans[i] << endl;
    }
}

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

int main() {

  std::vector<int> v;
  int w;
  int n;
  int a, b;

  std::cin >> w;
  for(int i = 1; i <= w; ++i) {
    v.push_back(i);
  }

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

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

C++: #include <iostream>
#include <sstream>
#include <string>
int main()
{
  int w, n;
  std::cin >> w;
  std::cin >> n;
  int num[w + 1];
  for (int i = 1; i <= w; i++) {
    num[i] = i;
  }
  while (n--) {
    std::string line;
    std::cin >> line;
    int index = line.find(",");
    if (index != -1) line.replace(index, 1, " ");
    std::istringstream iss(line);
    int a, b, temp;
    iss >> a >> b;
    temp = num[a];
    num[a] = num[b];
    num[b] = temp;
  }
  for (int i = 1; i <= w; i++) {
    std::cout << num[i] << std::endl;
  }
  
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n,m;
	cin>>m>>n;
	vector<int>out(m);
	rep(i,m)out[i]=i+1;
	rep(i,n){
		int a,b;
		char d;
		cin>>a>>d>>b;
		swap(out[a-1],out[b-1]);
	}
	rep(i,m)cout<<out[i]<<endl;

}

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


int main() {
	int w, n;
	std::cin >> w >> n;
	std::vector<int> vl(w+1);
	for (int i = 1; i < w+1; i++) {
		vl[i] = i;
	}
	for (int j = 0; j < n; j++) {
		int a, b, c;
		std::scanf("%d,%d", &a, &b);
		c = vl[a];
		vl[a] = vl[b];
		vl[b] = c;
	}
	for (int i = 1; i < w + 1; i++) {
		std::cout << vl[i] << std::endl;
	}
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 int v[35];
 
 int main()
 {
   int w,n;
   cin>>w>>n;
   for(int i=1;i<=w;i++) v[i]=i;
   while(n--)
   {
     int l,r;
     char temp
     cin>>l>>temp>>r;
     swap(v[l],v[r]);          
   } 
   for(int i=1;i<=w;i++)
   {
     cout<<v[i]<<endl;        
   }
   //while(1);      
   return 0;    
 }

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 int v[35];
 
 int main()
 {
   int w,n;
   cin>>w>>n;
   for(int i=1;i<=w;i++) v[i]=i;
   while(n--)
   {
     int l,r;
     char temp;
     cin>>l>>temp>>r;
     swap(v[l],v[r]);          
   } 
   for(int i=1;i<=w;i++)
   {
     cout<<v[i]<<endl;        
   }
   //while(1);      
   return 0;    
 }

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

int main() {
	int i,n,w,a1,a2,temp;
	char ch;
	
	cin >>w >>n;

	vector<int> amida;
	
	for(i=0;i<w;i++)
		amida.push_back(i+1);
	
	for(i=0;i<n;i++){
		cin >> a1;
		cin >> ch;
		cin >> a2;
		
		temp = amida[a1-1];
		amida[a1-1] = amida[a2-1];
		amida[a2-1] = temp;
		
	}
	
	for(i=0;i<w;i++){
		cout << amida[i] <<endl;
	}	
			
	return 0;
  
}

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

using namespace std;

int main()
{
	int w, n, b, c, p;
	int a[31];

	cin >> w >> n;

	for (int i = 1; i <= w; i++){
		a[i] = i + 1;
	}
	
	for (int i = 1; i <= n; i++){
		scanf("%d,%d", &b, &c);
		p = a[b];
		a[b] = a[c];
		a[c] = p;
	}

	for (int i = 1; i <= w; i++){
		printf("%d\n", a[i] - 1);
	}
}

C++: //#define _USE_MATH_DEFINES
#include <iostream>
//#include <stdio.h>
//#include <iomanip>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <cmath>
//#include <time.h>

using namespace std;


int main(){

	int w, n;
	int a, b;
	char c;
	vector <int> aa;

	cin >> w;

	for (int i = 0; i < w; i++){
		aa.push_back(i + 1);
	}
	
	cin >> n;

	while (n--){
		cin >> a >> c >> b;
		swap(aa[a - 1], aa[b - 1]);
	}

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


	return 0;
}