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

int main()
{
	int w,n;
	vector<int> list;

	cin >> w >> n;

	for(int i=0;i<w;++i)
		list.push_back(i);

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

		a--;
		b--;

		tmp		= list[a];
		list[a]	= list[b];
		list[b]	= tmp;

	}

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

	return 0;
}

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

using namespace std;

int main() {
    int w,n,amida[30],yoko1,yoko2,i;

    cin >> w >> n;

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

    for(i = 0;i < n;i++){
        scanf("%d,%d",&yoko1,&yoko2);
        int box = amida[yoko1];
        amida[yoko1] = amida[yoko2];
        amida[yoko2] = box;
    }

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

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

int main()
{
  int w,n;
  int c[]={0};
  int a,b;
  //  int temp;

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

  for(int i=0; i<=n; i++){
    c[i]=i;
  }

  for(int i=0; i<n; i++){
    scanf("%d,%d", &a,&b);
    swap(c[a], c[b]);
  }

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

C++: #include <iostream>

using namespace std;


int main(int argc, char const* argv[])
{
	int w,n;
	int a[30],b[30];
	int answer[31];

	cin >> w;

	for( int i = 0;i < 30;i++ ){
		a[i] = b[i] = 0;
		answer[i+1] = 0;
	}

	cin >> n;

	char comma;
	for( int j = 0;j < n;j++ ) cin >> a[j] >> comma >> b[j];

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

	for( int i = 1;i <= w;i++ ) cout << answer[i] << endl;


	return 0;
}

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

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

C++: #include <iostream>
#include <list>
using namespace std;
void swap(char *in,int a,int b)
{
    char tp;
    tp=in[a];
    in[a]=in[b];
    in[b]=tp;
}
int main()
{
    char *lost,a,b,p;
    int w,n,i;
    cin>>w;
    lost=new char[w];
    for (i=1;i<=w;i++)
        lost[i-1]=i+0x30;
    cin>>n;
    while(n--)
    {
        cin>>a>>p>>b;
        swap(lost,a-0x30-1,b-0x30-1);
    }
    for (i=0;i<w;i++)
    {
        cout<<lost[i]<<endl;
    }
    return 0;
}

C++: //-------------
//include
//-------------
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <numeric>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef  long long LL;
typedef  vector<int> VI;
typedef  vector<string> VS;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//-------------
//repetition
//-------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(x) REP(i,SZ(x))cerr<<i<<x<<"="<<x[i]<<endl;
#define SIZE(x) cout<<sizeof(x)<<endl;
const int MOD = 1000000007;
//-------------
//cout
//-------------
#define COUTL(x) cout<<x<<endl
#define COUT(x) cout<<x
//-------------
//??£?¨??????\
//-------------
#define INTIN(x) int x; cin>>x;
#define INTINTIN(x,y) int x,y; cin>>x>>y;
#define STRIN(x) string x; cin>>x;
int main()
{
	VI amida;
	int w,n;
	cin >> w >> n;
	REP(i,w)
	{
		amida.push_back(i+1);
	}
	REP(i, n)
	{
		string temp;
		cin >> temp;
		int x = temp[0] - 48;
		int y = temp[2] - 48;
		int test;
		test = amida[x-1];
		amida[x - 1] = amida[y - 1];
		amida[y - 1] = test;
	}
	REP(i, w)
	{
		if (i == w-1)
		{
			COUT(amida[i]);
		}
		else
		{
			COUT(amida[i]);
		}
	}
	#ifdef _DEBUG
	while(1);
#endif
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	int w,h;
	cin>>w>>h;
	vi amida(w+1);
	rep(i,amida.size())
		amida[i]=i;
	rep(i,h){
		int a,b;
		scanf("%d,%d",&a,&b);
		swap(amida[a],amida[b]);
	}
	repi(i,1,amida.size())
		cout<<amida[i]<<endl;
	
	return 0;
}

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

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