Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	lines, _ := strconv.Atoi(sc.Text())
	l := make([]int, lines)
	for i := 0; i < lines; i++ {
		l[i] = i + 1
	}

	sc.Scan()
	rows, _ := strconv.Atoi(sc.Text())
	for i := 0; i < rows; i++ {
		sc.Scan()
		s := strings.Split(sc.Text(), ",")
		a, _ := strconv.Atoi(s[0])
		b, _ := strconv.Atoi(s[1])

		l[a-1], l[b-1] = l[b-1], l[a-1]
	}
	for _, j := range l {
		fmt.Println(j)
	}
}

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

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[5];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[len];
    for(int i = 0; i < len; i++){
        array[i] = i+1;
    }
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

C++: #include <stdio.h>

int
main(void)
{
	char line[80];
	int w;
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &w) != 1) {
		return 1;
	}

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	int a[n];
	int b[n];

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d,%d", &(a[i]), &(b[i])) != 2) {
			return 1;
		}
	}

	int r[w];
	for (int i = 1; i <= w; i++) {
		int k = i;
		for (int j = 0; j < n; j++) {
			if (a[j] == k) {
				k = b[j];
			} else if (b[j] == k) {
				k = a[j];
			}
		}
		r[k-1] = i;
	}

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

	return 0;
}

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

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

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

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

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

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

	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		int x, y;

		string s;
		cin >> s;

		stringstream ss;
		ss << s;

		ss >> x;
		ss.ignore();
		ss >> y;

		swap(a.at(x - 1), a.at(y - 1));
	}

	for (int i = 0; i < w; i++)
	{
		cout << a.at(i) << endl;
	}
}

C++: #include <cstdio>
#include <iostream>
#include <map>
#include <vector>
#define P pair<int, int>
using namespace std;

int main()
{	
	int w, n;
	cin >> w >> n;
	vector<int> v(w);
	for (int i = 1; i <= w; i++)
		v[i - 1] = i;
	P p;
	int t;
	for (int i = 0; i < n; i++) {
		scanf("%d,%d", &p.first, &p.second);
		t = v[p.first - 1];
		v[p.first - 1] = v[p.second - 1];
		v[p.second - 1] = t;
	}
	
	for (int i = 0; i < w; i++)
		cout << v[i] << endl;
	
		
	return 0;
}

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

int main(){

  int n,m,x,y;

  vector <int> a;

  cin >> n;

  for(int i=0;i<=n;i++){
    a.push_back(i);
    a[i]=i;
  }

  cin >> m;
  for(int i=0;i<m;i++){
    scanf("%d,%d",&x,&y);
    swap(a[x],a[y]);
  }

  for(int i=1;i<=n;i++) cout << a[i] << endl;
}