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<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long

signed main(){
        //int a;
        //while( scanf("%lld", &a) != EOF ){}

        int w;
        scanf("%lld",&w);
        vector<int> line(w);
        for(int i=0;i<w;i++){
                line[i] = i;
        }

        int n;
        scanf("%lld",&n);
        for(int i=0;i<n;i++){
        int a,b;
        scanf("%lld,%lld",&a,&b);
        int t = line[a-1];
        line[a-1] = line[b-1];
        line[b-1] = t;
        }

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


        return 0;
}

C++: #include<stdio.h>

int main(){
        int W,N;
        int w[30];

        scanf("%d",&W);
        scanf("%d",&N);

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

        int a,b,dm;
        for(int i=0;i<N;i++){
                scanf("%d,%d",&a,&b);

                //swap(w[a-1],w[b-1]
                dm = w[a-1];
                w[a-1]=w[b-1];
                w[b-1]=dm;
        }

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

        return 0;
}

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

int main()
{
	int n,i;
	cin>>n;
	int*p;
	p=new int[n];  
	for(i=0;i<n;i++)
    *(p+i)=i+1;
    
    int x,y,temp,k;
    cin>>k;
    for(i=0;i<k;i++)
    {	
    	scanf("%d,%d",&x,&y	);
    	temp=*(p+x-1);
    	*(p+x-1)=*(p+y-1);
    	*(p+y-1)=temp;
    }
    for(i=0;i<n;i++)
    	cout<<*(p+i)<<endl;
    
	delete []p;
	return 0;
}

C++: //--------------------------------------------------template----------------------------------------//
//c
#include <stdio.h>
#include <time.h>
#include <math.h>
//c++
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <complex>
#include <cmath>
//c++11
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.rbegin(),v.rend())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int w, n;

int a[31], b[31];

int main() {
	cin >> w >> n;
	map<int, int> m;
	for (int i = 0; i < w; i++) {
		m[i + 1] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		int c, d;
		scanf("%d,%d", &c, &d);
		int temp = m[c];
		m[c] = m[d];
		m[d] = temp;
	}
	for (int i = 1; i <= w; i++) {
		cout << m[i] << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>


using namespace std;

int main() {
    size_t w;
    scanf("%zu", &w);
    vector<size_t> dlots(w);
    iota(dlots.begin(), dlots.end(), 1);

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

    for (size_t i=0; i<w; ++i)
        printf("%zu\n", dlots[i]);

    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,i,z,x[1000];
	char w[10];
	scanf("%d %d",&a,&b);
	for(i=0;i<a;i++){
		x[i]=0;
		x[i]=i+1;
	}
	z=0;
	for(i=0;i<b;i++){
		scanf("%d %c %d",&c,w,&d);
		z=x[c-1];
		x[c-1]=x[d-1];
		x[d-1]=z;
	}
	for(i=0;i<a;i++){
		printf("%d\n",x[i]);
	}
	return 0;
}

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

void swap(int *x, int*y)
{
	int temp=0;

	temp = *x;

	*x = *y;

	*y = temp;
}

int main()
{
	int w=0, n=0;

	std::cin >> w >> n;

	std::vector<int> order;

	for(int i=0; i<=w; ++i)
	{
		order.push_back(i);//1〜wまで添え字を使用
	}

	int a=0,b=0;

	char c;

	for(int i=0; i<n; ++i)
	{
		std::cin >> a >> c >> b; 

		swap(&order[a], &order[b]);
	}

	for(int i=1; i<=w; ++i)
	{
		std::cout << order[i] << '\n';
	}

}

C++: #define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

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

C++: // 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
#include <typeinfo>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
	ll w, n;

	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		std::string d[2];
		roop(i, s.length()) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		int swap[2];
		roop(i, 2) {
			swap[i] =stoi(d[i]);
		}
		ll before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}

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

int main(){
	int w;
	int n;
	int ary[30];

	cin >> w >> n;
	for (int i = 1; i <= w; i++){
		ary[i] = i;
	}

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

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


	return 0;
}