Go: package main

import (
        "fmt"
)

const MAX_N = 31
var lines [MAX_N]int

func main() {
        var n, w int
        fmt.Scanf("%d", &n)
        fmt.Scanf("%d", &w)

        Init()
        var l, r int
        for {
                _, err := fmt.Scanf("%d,%d", &l, &r)
                if err != nil {
                        break
                }

                Swp(l, r)
        }

        for i := 1; i <= n; i++ {
                fmt.Printf("%d\n", lines[i])
        }
}

func Swp(l int, r int) {
        var s int
        s = lines[l]
        lines[l] = lines[r]
        lines[r] = s
}

func Init() {
        for i := 0; i < MAX_N; i++ {
                lines[i] = i
        }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int w,n,a,b,ans[30];
	cin>>w>>n;
	for(int i=1;i<=w;i++){
		ans[i]=i;
	}
	for(int i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		swap(ans[a],ans[b]);
	}
	for(int i=1;i<=w;i++){
		cout<<ans[i]<<endl;
	}
	return 0;
}

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

using namespace std;

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

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

using namespace std;


void swap(int* a,int s,int v){
	int c;
	c=a[s];
	a[s]=a[v];
	a[v]=c;
	return;
}

int main(){
	int w,n;
	int ans[100];
	int sw[2];
	
	scanf("%d %d",&w,&n);
	int i;
	for(i=1;i<=w;i++){
		ans[i]=i;
	}
	for(i=0;i<n;i++){
		sw[1]=sw[0]=0;
		scanf("%d,%d",&sw[0],&sw[1]);
		swap(ans,sw[0],sw[1]);
	}
	
	for(i=1;i<=w;i++){
		printf("%d\n",ans[i]);
	}
	
	return 0;
}

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

C++: #include<cstdio>

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

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
long i,ww,n,a,b,w[31],t;
char c;
cin>>ww>>n;
for(i=1;i<=ww;i++)w[i]=i;
for(i=1;i<=n;i++){
cin>>a>>c>>b;
t=w[a];w[a]=w[b];w[b]=t;
}
for(i=1;i<=ww;i++)cout<<w[i]<<endl;
return 0;
}

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

using namespace std;

int main() {
    int lot[31];
    int w,n;
    
    for(int i=1;i<=30;i++){
        lot[i]=i;
    }

    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<iostream>
using namespace std;

int main(){
int w = 0;
cin >> w ;
int n = 0;
cin >> n;
int i = 1;
int a[w];
loop(i = 0,i < w,i++){
a[i] = i + 1;
}
loop(i = 1,i <= n,i++){
int aa = 0;int bb = 0;
char split;
cin >> aa >> split >> bb ;
int c = 0;
c = a[aa - 1];
a[aa - 1] = a[bb - 1];
a[bb - 1] = c;
}
loop(i = 0,i < w, i++)
{
cout << a[i] << endl;
}
    return 0;
}

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

using namespace std;

int main()
{
    int ver,hor;
    int a,b;
    int i,tmp;
    char c;
    cin >> ver;
    cin >> hor;

    vector<int> v;
    for(i=0;i<ver;i++)
        v.push_back(i+1);
    for(i=0;i<hor;i++)
    {
        cin >> a >> c >> b;
        tmp = v[a-1];
        v[a-1] = v[b-1];
        v[b-1] = tmp;
    }
    for(i=0;i<ver;i++)
        cout << v[i] << endl;
    cout << endl;
    return 0;
}

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

using namespace std;

int main() {
    int w, n, a, b;
    char com;
    int lot[31];
    
    for(int i=0; i<30; i++){
        lot[i] = i;
    }
    
    cin >> w >> n;
    for(int i=0; i<n; i++){
        cin >> a >> com >> b;
        swap(lot[a], lot[b]);
    }
    for(int i=1; i<=w; i++){
        cout << lot[i] << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int w, n;
	int a[31];
	cin >> w >> n;
	for (int i = 1; i <= w; i++){
		a[i] = i;
	}
	int x, y;
	char t;
	for (int i = 0; i < n; i++){
		cin >> x >> t >> y;
		swap(a[x], a[y]);
	}
	for (int i = 1; i <= w; i++){
		cout << a[i] << endl;
	}
}

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

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

    int *progression = new int[w + 1];
    for (int i = 1; i <= w; ++i) {
        progression[i] = i;
    }

    for (int i = 0; i < n; ++i) {
        int a, b;
        char comma;
        cin >> a >> comma >> b;

        int tmp = progression[a];
        progression[a] = progression[b];
        progression[b] = tmp;
    }

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

    delete[] progression;
}

C++: #include<iostream>
int main(){
	int w,n,a[30][2],b[30];
	std::cin>>w
		>>n;
	for(int i=0;i<n;++i){
		for(int j=0;j<2;++j){
			std::cin>>a[i][j];
		}
	}
	for(int i=1;i<=w;++i){
		b[i]=i;
	}
	for(int i=0;i<n;++i){
			int x=b[a[i][0]];
			b[a[i][0]]=b[a[i][1]];
			b[a[i][1]]=x;
	}
	for(int i=1;i<=w;++i){
		std::cout<<b[i]<<std::endl;
	}
	return 0;
}

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

using namespace std;

void swap(int *var1, int *var2) {
  int tmp = *var1;
  *var1 = *var2;
  *var2 = tmp;
}

int main() {
  int w;
  int n;

  cin >> w;
  cin >> n;

  int vertical_line[w];
  for (int v_i = 0; v_i < w; v_i++)
    vertical_line[v_i] = v_i+1;

  for (int n_i = 0; n_i < n; n_i++) {
    int node1, node2;
    scanf("%d,%d", &node1, &node2);
    swap(vertical_line+node1-1, vertical_line+node2-1);    
  }

  for (int v_i = 0; v_i < w; v_i++)
    cout << vertical_line[v_i] << endl;

  return 0;
}

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

int main(){

  int w;
  int n;
  int i;
  int a;
  int b;
  int number[32] = {};

  scanf("%d", &w);
  scanf("%d", &n);

  for(i = 1; i <= w; i++){
    number[i] = i;
  }

  for(i = 0; i < n; i++){
    scanf("%d,%d", &a, &b);
    swap(number[a], number[b]);
  }
  for(i = 1; i <= w; i++){
    cout<<number[i]<<endl;
  }


  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int w,n,c,x,y;
	cin>>w>>n;
	int a[w+1]={0};
	for(int i=0;i<=w;i++)a[i]=i;
	for(int i=0;i<n;i++)
	{
		scanf("%d,%d",&x,&y);
		c=a[x],a[x]=a[y],a[y]=c;
	}
	for(int i=1;i<=w;i++)
	{
		cout<<a[i]<<endl;
	}
	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){
	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] << ' ';
	}

	std::cout << '/n';

	return 0;
}

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

using namespace std;

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

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

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

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

    return 0;
}