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>
#include <string>
#include <strstream>
using namespace std;

int main()
{
	int w,n;
	cin >> w >> n;
	vector<int> line;
	for(int i=0; i<w; ++i)
	{
		line.push_back(i);
	}

	for(int i=0; i<n; ++i)
	{
		string str;
		cin >> str;
		int dot = str.find(',');
		string numa = str.substr( 0, dot );
		string numb = str.substr( dot+1, str.size()-1 );
		int A,B;
		istrstream( numa.data() ) >> A;
		istrstream( numb.data() ) >> B;
		--A;
		--B;
		int x = line[A];
		line[A] = line[B];
		line[B] = x;
	}

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

C++: #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    // default
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
  }
  return 0;
}

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]);
}