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

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

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

  int w,n;
  scanf("%d %d",&w,&n);
  int left[n];
  int right[n];
  int ans[w+1];
  for(int i=0;i<n;i++) {
    scanf("%d,%d",&left[i],&right[i]);
  }
  for(int i=1;i<=w;i++) {
    int state = i;
    int t = 0;
    while(t<n) {
      if(left[t] == state) {
        state = right[t];
      }
      else if(right[t] == state) {
        state = left[t];
      }
      t++;
    }
    ans[state] = i;
  }
  for(int i=1;i<=w;i++) {
    printf("%d\n",ans[i]);
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
  int w, n, nx, ny;

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