Go: package main

import (
        "fmt"
)

const MAX_N = 31
var lines [MAX_N]int

func main() {
        var n, w int
        fmt.Scanf("%d", &n)
        fmt.Scanf("%d", &w)

        Init()
        var l, r int
        for {
                _, err := fmt.Scanf("%d,%d", &l, &r)
                if err != nil {
                        break
                }

                Swp(l, r)
        }

        for i := 1; i <= n; i++ {
                fmt.Printf("%d\n", lines[i])
        }
}

func Swp(l int, r int) {
        var s int
        s = lines[l]
        lines[l] = lines[r]
        lines[r] = s
}

func Init() {
        for i := 0; i < MAX_N; i++ {
                lines[i] = i
        }
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	
	int N=in();
	vector<int> V(N);
	iota(ALL(V),1);
	int Q=in();
	REP(i,Q){
		int a,b;
		scanf("%d,%d",&a,&b);
		swap(V[a-1],V[b-1]);
	}
	for(auto& x:V){
		out(x);
	}

	return 0;
}

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

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

void solver() {
    int w, n;
    vector<int> a, b;
    vector<pair<int, int>> ans;
    cin >> w;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int ta, tb;
        scanf("%d,%d", &ta, &tb);
        a.push_back(ta);
        b.push_back(tb);
    }

    FOR(i, w) {
        auto p = i + 1;
        FOR(j, n) {
            if (p == a[j]) {
                p = b[j];
            } else if (p == b[j]) {
                p = a[j];
            }
        }
        ans.push_back({p, i + 1});
    }
    sort(ans.begin(), ans.end());

    FOR(i, w) cout << ans[i].second << " ";
    cout << endl;
}

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

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

class Amida{
public:
	void shokika(int a[],int b);
	void irekae(int bou[], int a, int b);
	void show(int bou[], int a);
};

void Amida::shokika(int a[],int b){
	for (int i = 0; i < b; i++){
		a[i] = i+1;
	}
}

void Amida::irekae(int bou[], int a, int b){
	int work;
	work = bou[a-1];
	bou[a-1] = bou[b-1];
	bou[b-1] = work;
}

void Amida::show(int bou[], int a){
	for (int i = 0; i < a; i++){
		cout << bou[i] << endl;
	}
}

int main(){
	int tate, yoko, *tatebou;
	Amida ami;
	cin >> tate >> yoko;

	tatebou = new int[tate];
	ami.shokika(tatebou, tate);

	int a, b;
	for (int i = 0; i < yoko; i++){
		scanf("%d,%d", &a, &b);
		ami.irekae(tatebou, a, b);
	}

	ami.show(tatebou,tate);

	return 0;
}

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

using namespace std;

int w;//縦本の総本数
int n;//横棒の数
int D[31];//あみだの並び順


queue<pair<int,int> > que;
int a,b;
int temp;

int main(){
  scanf("%d %d",&w,&n);
  for(int i = 1;i <= w;i++){
    D[i] = i;
  }//あみだを初期化
  for(int i = 0;i < n;i++){
    scanf("%d,%d",&a,&b);
    que.push(pair<int,int>(a,b));
  }
  for(int i = 0;i <n;i++){
    a =que.front().first;
    b =que.front().second;
    temp = D[b];
    D[b] = D[a];
    D[a] = temp;
    que.pop();
  }
  for(int i = 1;i <=w;i++){
    printf("%d\n",D[i]);
  }

}

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 <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int n,m;
  cin>>n>>m;
  int w[30];
  rep(i,n)w[i] = i + 1;
  while(m--){
    int a,b;
    scanf("%d,%d",&a,&b);
    swap(w[--a],w[--b]);
  }
  rep(i,n)cout<<w[i]<<endl;
}

C++: import java.util.Scanner;
public class Main{
	private static void change(int data[],int f,int s){
		int temp = data[f-1];
		data[f-1] = data[s-1];
		data[s-1] = temp;
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] data = new int[w];
		for(int i=0;i<w;i++){
			data[i]=i+1;
		}
		int first =0;
		int second =0;
		scan.useDelimiter(",");
		for(int i=0;i<n;i++){
			first = scan.nextInt();
			second = scan.nextInt();
			change(data,first,second);
		}
		for(int i=0;i<=n;i++)
			System.out.println(data[i]);
	}

}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#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)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int w, n, x, y, tmp;
  char c;
  VI v;

  cin >> w >> n;

  FOR(i, 0, w) v.PB(i+1);
  FOR(i, 0, n) {
    cin >> x >> c >> y;
    tmp = v[x-1];
    v[x-1] = v[y-1];
    v[y-1] = tmp;
  }
  FOR(i, 0, w) cout << v[i] << endl;
}