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++: #include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cstring>

using namespace std;

int main(){
	int widthCount = 0, heightCount = 0;
	string tmp;

	cin >> widthCount >> heightCount;

	vector<int> width(widthCount);
	for(int i = 0; i < widthCount; i++){
		width[i] = i + 1;
	}
	
	pair<int,int> height;
	/*height.first = vector<int>(heightCount,0);
	height.second = vector<int>(heightCount,0);*/

	char *a = new char[4];
	char *tp;

	for(int i = 0; i < heightCount; i++){
		cin >> tmp;
		
		strcpy(a,tmp.c_str());
		
		tp = strtok(a,",");
		height.first = atoi(tp);
		tp = strtok(NULL,",");
		height.second = atoi(tp);

		swap(width[height.first - 1],width[height.second - 1]);

	}

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

	return 0;
}

C++: include<iostream>
using namespace std;
int main(){
    int w,n,tmp;
    cin>>w>>n;
    int a[w];
    string s;
    for(int i=0;i<w;i++) a[i]=i+1;
    for(int i=0;i<n;i++){
        cin>>s;
        int x=s[0]-(int)'1',y=s[2]-(int)'1';
        tmp=a[x];
        a[x]=a[y];
        a[y]=tmp;
    }
    for(int i=0;i<w;i++) cout<<a[i]<<endl;
    return 0;
}

C++: #include <iostream>
#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 <iostream>
#include <vector>

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int w, n;
	cin >> w;
	cin >> n;
	vector<P> Vec(n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d,%d", &Vec[i].first, &Vec[i].second);
	}
	vector<int> Answer(w + 1);
	int pos;
	for(int i = 1; i <= w; ++i)
	{
		pos = i;
		for(int j = 0; j < n; ++j)
		{
			if(pos == Vec[j].first)
			{
				pos = Vec[j].second;
			}
			else if(pos == Vec[j].second)
			{
				pos = Vec[j].first;
			}
		}
	Answer[pos] = i;
	}
	for(int i = 1; i <= w; ++i)
	{
		cout << Answer[i] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){

	using namespace std;

	vector<int> array;
	int w,n;
	int a,b,i,j,k;
	
	scanf("%d %d\n",&w,&n);
	
	for(i=0;i<w;i++){
		array.push_back(i+1);
	}
	
	for(i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		k=array[a-1];
		array[a-1]=array[b-1];
		array[b-1]=k;
	}
	
	for(i=0;i<w;i++){
		cout << array[i] << endl;
	}
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main(){
	int w, n; cin >> w >> n;
	vi x(w);
	rep(i, w) x[i] = i + 1;
	rep(i, n) {
		int a, b; char c; cin >> a >> c >> b;
		swap(x[a - 1], x[b - 1]);
	}
	rep(i, w) cout << x[i] << endl;
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <istream>
#include <iomanip>
 
#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int w = 0;
	int n = 0;
	int a = 0;
	int b = 0;
	char tmp = 0;
	std::vector<int> z;
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	ifs >> w >> n;
#else
	std::cin >> w >> n;
#endif

	z.resize(w);
	for(int i = 0; i < w; i++){
		z[i] = i + 1;
	}
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a >> tmp >> b;
#else
		std::cin >> a >> tmp >>  b;
#endif
		std::swap(z[a - 1], z[b - 1]);
	}
	for(int i = 0; i < w; i++){
		std::cout << z[i] << std::endl;
	}
	return 0;
}

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

int main(){
	int w, n, num[31], damy, i, j, bou1, bou2;

	cin >> w >> n;

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

	for(i = 0; i < n; i++){
		scanf("%d,%d", &bou1, &bou2);
		damy = num[bou1];
		num[bou1] = num [bou2];
		num[bou2] = damy;
	}

	for(i = 1; i <= w; i++){
		cout << num[i] << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define dbg(x) cout << #x"="<< (x) << endl
#define fi first
#define se second

vector<int> change(vector<int> x,int k,int l){
	vector<int> m=x;
	x[k] = m[l];
	x[l] = m[k];
	return x;
}

int main(){
	int w,n;
	cin >> w;
	cin >> n;
	vector<int> ans(w);
	rep(i,w){
		ans[i]=i+1;
	}
	vector<int> m = ans;
	pair<int,int> a;
	string b;
	rep(i,n){
		cin >> b;
		sscanf(b.c_str(),"%d,%d",&a.fi,&a.se);
		m=ans;
		ans[a.fi-1] = m[a.se-1];
		ans[a.se-1] = m[a.fi-1];
	}
	rep(i,w){
		cout << ans[i] << endl;
	}
	
}

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

int main()
{
	int w,n;
	cin >> w >> n;
	vector<int> line;
	for(int i=0; i<w; ++i)
	{
		line.push_back(i);
	}

	for(int i=0; i<n; ++i)
	{
		string str;
		cin >> str;
		int dot = str.find(',');
		string numa = str.substr( 0, dot );
		string numb = str.substr( dot+1, str.size()-1 );
		int A,B;
		istrstream( numa.data() ) >> A;
		istrstream( numb.data() ) >> B;
		--A;
		--B;
		int x = line[A];
		line[A] = line[B];
		line[B] = x;
	}

	for(int i=0; i<w; ++i)
	{
		cout << line[i]+1 << '\n';
	}
}

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

using namespace std;

void change(int *x, int *y);

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

void change(int *x, int *y){
	int type = *x;
	*x = *y;
	*y = type;
}

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

int main() {
  int w, n;
  int x[30];
  int a, b, tmp;

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