Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}

C++: #include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))
#define N 35

int a[N];

int main(void) {
  int w;
  scanf("%d", &w);
  REP(i, w) {
    a[i] = i + 1;
  }
  int n;
  scanf("%d", &n);
  REP(i, n) {
    int x,y;
    scanf("%d,%d", &x, &y);
    x--,y--;
    swap(a[x],a[y]);
  }

  REP(i, w) {
    printf("%d\n", a[i]);
  }
}

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

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

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

int main()
{
 int x[30];
 int w, n;
 
 cin >> w >> n;
 for(int i=0; i<w; i++) x[i] = i+1;

 int a, b;
 for(int i=0; i<n; i++){
  cin  >> a >> b;
  int tmp = x[a];
  x[a] = x[b];
  x[b] = tmp;
 }

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

C++: #include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>

void readCsv2(int *a, int *b) {
	char *buf = new char[512], *ptok;
	scanf("%511s", buf);
	if ((ptok = strtok(buf, ",")) != NULL) {
		*a = atoi(ptok);
		if ((ptok = strtok(NULL, ",")) != NULL) {
			*b = atoi(ptok);
		} else {
			b = 0;
		}
	} else {
		a = b = 0;
	}
	delete [] buf;
}

int main() {
	using namespace std;
	int w, n, a, b;
	vector<int> l;
	scanf("%d\n%d", &w, &n);
	for (int i = 1; i <= w; ++i) {
		l.push_back(i);
	}
	for (; n > 0; --n) {
		readCsv2(&a, &b);
		swap(l[a - 1], l[b - 1]);
	}
	for (vector<int>::iterator i = l.begin(); i != l.end(); ++i) {
		printf("%d\n", *i);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <set>
#include <cmath>

namespace CSV{
	class CistreamCsv { // http://homepage2.nifty.com/well/Stream.html CSV Stream
		// }js[^ endl Ìè`
		friend CistreamCsv& CSV::endl(CistreamCsv& riscsv);
	private:
		std::istream& m_ris;     // üÍÉg¤ istream ÌQÆ
	public:
		CistreamCsv(std::istream& ris) : m_ris(ris) {}
		CistreamCsv& operator >>(int& ri) {
			ri = 0;
			int iChar = 0;
			// óðÇÝòÎ·B
			while (isspace(iChar = m_ris.get()) && iChar != '\n') {}
			if (iChar == EOF ) { return *this; }
			std::string strValue;
			if (iChar == '\n') { m_ris.putback(iChar); iChar = 0; }
			else               { strValue += iChar;               }
			// R}ÜÅÇÞB
			while ((iChar = m_ris.get()) != ',' && iChar != EOF && iChar != '\n') {
				strValue += iChar;
			}
			ri = std::atoi(strValue.c_str());
			if (iChar == EOF ) { return *this;         }
			if (iChar == '\n') { m_ris.putback(iChar); }
			return *this;
		}
		// }js[^ðó¯üêé½ßÌ}üZq
		CistreamCsv& operator >>(CistreamCsv& (*pmanipulatorfunction)(CistreamCsv&)) {
			return (*pmanipulatorfunction)(*this);
		}
	};
	CistreamCsv& endl(CistreamCsv& riscsv) {
        int iChar = 0;
        while ((iChar = riscsv.m_ris.get()) != '\n' && iChar != EOF) {}        // sÜÅÇÝòÎ·B
        return riscsv;
    }
};
int main(int,char**){
	int w,n;
	std::cin >> w >> n;
	CSV::CistreamCsv CSVin(std::cin);
	CSVin>> CSV::endl;

	std::vector<int> dl;
	dl.reserve(w);
	for(int i(0);i<w;++i) dl.push_back(i);
	while(n--){
		int s1,s2;
		CSVin>> s1>>s2>>CSV::endl;
		//std::cout << s1<<s2<<std::endl;
		std::swap(dl[s1-1],dl[s2-1]);
	}
	for(int i(0);i<w;++i) std::cout << dl[i]+1<<std::endl;
	return 0;
}

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

using namespace std;

int main() {
	int i, j, l, num[31], w, n, a=0, b=0, c;
	char s[5], as[2], bs[2];
	
	cin >> w;
	for (i = 1; i <= w; i++) {
		num[i] = i;
	}
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> s;
		for (j = 0; s[j] != ','; j++) {
			as[j] = s[j];
		}
		for (l=j; s[j + 1] != NULL; j++) {
			bs[j - l] = s[j + 1];
		}
		a = atoi(as);
		b = atoi(bs);
		c = num[a];
		num[a] = num[b];
		num[b] = c;
	}
	for (i = 1; i <= w; i++) {
		cout << num[i] << endl;
	}
	return 0;
}

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

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

C++: #include<iostream>
void swap(int a,int b){
	int t=a;
	a=b;
	b=t;
	return ;
	}
int main(){
	int w;
	int n;
	int c[30];
	int a[30];
	int b[30];
	scanf("%d",&w);
	scanf("%d",&n);
	for(int i=0;i<w;i++){
		c[i]=i;
		}
	for(int i=0;i<n;i++){
		scanf("%d%d",&a[i],&b[i]);
        swap(c[a[i]],c[b[i]]);
       }
     for(int i=0;i<w;i++){
     	cout<<c[i]<<endl;
     }
     return 0;
    }

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

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

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

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