Go: package main

import "fmt"

func main() {
	var w, n, a, b, i, te int
	var amida [31]int
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)
	for i := 1; i <= w; i++ {
		amida[i] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d,%d", &a, &b)
		te = amida[a]
		amida[a] = amida[b]
		amida[b] = te
	}
	for i := i; i <= w; i++ {
		fmt.Printf("%d\n", amida[i])
	}
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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>
#include <fstream>
#include <complex>
#include <math.h>
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 pair<long, long> PLL;
typedef long long LL;
//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(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

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

const long double EPS = 1e-12;
const double INF = 1e12;



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

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int w, n; cin >> w >> n;
  vi32 now(w);
  iota(all(now), 1);
  rep(i, n) {
    int a, b;
    char c;
    cin >> a >> c >> b;
    a--, b--;
    swap(now[a], now[b]);
  }
  rep(i, w) cout << now[i] << '\n';
}

C++: #include <iostream>
#include <cstring>
#include <cmath>

using namespace std;

int main()
{
    int w, n, a, b, i, j, len, arr[32], temp;
    char pair[10];

    cin>>w>>n;

    for(i=1; i<=w; i++)
        arr[i] = i;

    for(i=1; i<=n; i++)
    {
        cin>>pair;

        a = 0;
        b = 0;

        len = strlen(pair);

        for(j=len-1; pair[j]!=','; j--)
        {
            b = b+ (pair[j] - '0') * pow(10, len-1-j);
        }

        len = j;

        for(j=len-1; j>=0; j--)
        {
            a = a+ (pair[j] - '0') * pow(10, len-1-j);
        }

        temp = arr[a];
        arr[a] = arr[b];
        arr[b] = temp;
    }

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

    return 0;
}

C++: #include<iostream>
using namespace std;
int n;
int a[1000000];
int sum[1000000];
int main(int argc, char const *argv[])
{

	int tc[30];
	cin>>tc[30];
	int w,v;
	for (int i = 0; i < 30; ++i) tc[i] = i+1;
		for (int i = 0; i < v; ++i)
		{
			int a,b;
			cin>>a>>b;
			int c=tc[a-1];
			tc[a-1]=tc[b-1];
			tc[b-1];

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

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

#define add push_back
#define inf 2147000000

#define rep(i,n) for(int i=0;i<n;i++)
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	int w,h;
	int y1[30],y2[30],t[31];
	string str;
	scanf("%d%d",&w,&h);
	rep(i,h){
		cin>>str;
		y1[i] = str[0]-48;
		y2[i]=0;
		if(str[3]!='\0'){
			y2[i] = (str[2]-48)*10;
			y2[i]+=str[3]-48;
		}else{
			y2[i] = str[2]-48;
		}
	}
	rep(i,31)t[i]=i;
	
	rep(i,h){
		swap(t[y1[i]],t[y2[i]]);
	}
	
	rep(i,w)out(t[i+1]);
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define scanf scanf_s

int w, n;
int ban[35];
int main()
{
	REP(i, 35) ban[i] = i;
	cin >> w >> n;
	REP(i, n)
	{
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(ban[a], ban[b]);
	}
	FOR(i,1, w+1) cout << ban[i] << endl;
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int w,n;
	cin>>w>>n;
	int a[30],b[30],c[30];
	char d;
	for(int i=1;i<=w;i++){
		a[i]=i;
	}
	for(int i=1;i<=n;i++){
		cin>>b[i]>>d>>c[i];
	}
	for(int i=1;i<=n;i++){
		swap(a[b[i]],a[c[i]]);
	}
	for(int i=1;i<=w;i++){
		cout<<a[i]<<endl;
	}
	return 0;
}

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

int swap(int* x, int* y){
	int tmp = *y;
	*y = *x;
	*x = tmp;
}
	
int main(){
	int w, n, array[31];
    int a, b;
    
    char sep;
    
	for(int i=1; i<=30; i++){
		array[i] = i;
	}
	
	cin >> w;
	cin >> n;
	
	while(0<n){
		cin >> a >> sep >> b;
		
		swap(&array[a], &array[b]);
		--n;
	}
	
	for(int j=1; j<=w; j++){
		cout << array[j] << endl;
	}
	return 0;
}