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 <vector>
#include <cstdio>
using namespace std;

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

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

}

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

#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
	int w, n;

	cin >> w;
	cin >> n;

	vector<pair<int, int>> intersection(n);

	for(int i = 0; i < n; i++){
		scanf("%d,%d", &intersection[i].first, &intersection[i].second);
	}

	for(int i = 1; i <= w; i++){
		int r = i;
		for_each(intersection.rbegin(), intersection.rend(),
				[&r](const pair<int, int>& x){
					if(x.first == r){
						r = x.second;
					}else if(x.second == r){
						r = x.first;
					}
				}
		);
		cout << r << endl;
	}

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int swap(int *a,int *b){
	int w=*a;
	*a=*b;
	*b=w;
}
int main(){
	int w,n;
	cin>>w;
	int array[w];
	for(int i=1;i<=w;i++){
		array[i-1]=i;
//		cout<<array[i-1]<<endl;
	}
		
	cin>>n;
	for(int i=0;i<n;i++){
		int a,b;
		char c;
		cin>>a>>c>>b;
		swap(&array[a-1],&array[b-1]);
	}
	for(int i=1;i<=w;i++)cout<<array[i-1]<<endl;
	
}

C++: 
#include <iostream>
#include<STRING>
using namespace std;
int main() {
    int line;
    int side;
    int sidenum1,sidenum2;
    int linenum[line];
    char waste;
    cin>>line>>side;
    for(int i=0; i<line; i++){
        linenum[i]=i+1;
    }
    for(int i=0; i<side; i++){
        cin>>sidenum1>>waste>>sidenum2;
        swap(linenum[sidenum1-1],linenum[sidenum2-1]);
    }
    for(int i=0; i<line; i++){
        cout<<linenum[i]<<endl;
    }
    return 0;
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int w, n, a[32], b[32], ans[32];
int main(void) {
    cin >> w;
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d,%d", a+i, b+i);
    }
    for (int i = 1; i <= w; i++) {
        int now = i;
        for (int j = 0; j < n; j++) {
            if (now == a[j]) now = b[j];
            else if (now == b[j]) now = a[j];
        }
        ans[now] = i;
    }
    for (int i = 1; i <= w; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}