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
//------------------------------------------
#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 <queue>
#include <iterator>
#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;

//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 gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

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

C++: #include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long ull;
typedef long long ll;

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;

typedef pair<int ,int > P;

int n,m;
vector<int> vec;
int main()
{
	cin>>n;
	rep(i,n+1)
	{
		vec.pb(i);
	}

	cin>>m;

	rep(i,m)
	{
		int a,b;
		scanf("%d,%d",&a,&b);
		swap(vec[a],vec[b]);
	}
	rep(i,n+1)
	{
		if(!i) continue;
		cout<<vec[i]<<endl;
	}
	


	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

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

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

		int n = v.at(a - 1);
		v.at(a - 1) = v.at(b - 1);
		v.at(b - 1) = n;
	}

	for (int i = 0; i < w; i++) {
		cout << v.at(i) << endl;
	}
}

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

int main(void){
	int w,n;
	int a,b;
	int line[30];
	int i;
	char comma;

	for(i=0;i<30;i++){
		line[i]=i+1;
	}
	cin >> w;
	if(w<=30&&w>0){
		cin >> n;
		for(i=0;i<n;i++){
			cin >> a >> comma >> b;
			if(a>0&&b>0&&a<=w&&b<=w) swap(line[a-1],line[b-1]);
		}
		for(i=0;i<w;i++){
			cout << line[i] << endl;
		}
	}
	return 0;
}

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

struct THorizonalLine
{
	int Left;
	int Right;
};

int main()
{
	int w;
	cin >> w;
	int n;
	cin >> n;
	vector<int> StartingPoint(w);
	for(int i = 0; i < w; i++){
		StartingPoint[i] = i+1;
	}
	for(int i = 0; i < n; i++){
		THorizonalLine HorizonalLine;
		scanf("%d,%d",&HorizonalLine.Left,&HorizonalLine.Right);
		swap(StartingPoint[HorizonalLine.Left-1], StartingPoint[HorizonalLine.Right-1]);
	}
	for(int i = 0; i < w; i++){
		cout << StartingPoint[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
using namespace std;
void swap(int &a, int &b){
	int c=a;
	a=b;
	b=c;
}
vector<int> v;

int main(){
	int w, n;
	cin >> w >> n;
	int a[n], b[n];
	string s;
	for(int i=0; i<n; i++){
		cin >> s;
		a[i] = stoi(s);
		while(1){
			if(s[0]!=',') s.erase(s.begin(), s.begin()+1);
			else{
				s.erase(s.begin(), s.begin()+1);
				break;
			}
		}
		b[i] = stoi(s);
	}

	v.resize(w);
	for(int i=0; i<v.size(); i++) v[i]=i+1;
	for(int i=0; i<n; i++){
		swap(v[a[i]-1], v[b[i]-1]);
	}

	for(int i=0; i<n; i++) cout << v[i] << endl;

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int W, N; cin >> W >> N;
  int a[31], b[31];
  for(int i=0;i<N;++i)
    scanf("%d,%d", &a[i], &b[i]);
  
  int x[31];
  for(int i=1;i<=W;++i){
    int n = i;
    for(int j=0;j<N;++j){
      if(n == a[j])
	n = b[j];
      else if(n == b[j])
	n = a[j];
    }
    x[n] = i;
  }
  for(int i=1;i<=W;++i)
    cout << x[i] << endl;

  return 0;
}

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

void swap(int &a,int &b){
	int tmp;
	tmp = a;
	a = b;
	b = tmp;
}

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

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

using namespace std;

void Solution()
{
    int w, n;
    
    int temp; //data for swapping
    int a, b;
    char c;
        
    
    cin>>w;
    cin>>n;
    
    vector<int> v;
    
    for(int i = 0; i <= w; i++) // the smallest digit is 1
    {
        v.push_back(i);
    }
    
    for(int i = 0; i < n; i++)
    {
        cin>>a>>c>>b;
        
        temp = v[a]; //swap the position
        v[a] = v[b];
        v[b] = temp;
    }
    
    for(int i=1; i <= w; i++)
    {
        cout<<v[i]<<endl;
    }
}

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

C++: #include <cstdio>
using namespace std;
int main(){
  int *p,i,n,j,a1,b1,buf;
  scanf("%d",&n);
  p=new int[n];
  scanf("%d",&i);
  for(j=0;j<n;j++)p[j]=j+1;
  for(j=0;j<i;j++){
    scanf("%d,%d",&a1,&b1);
    a1--;b1--;
    buf=p[a1];
    p[a1]=p[b1];
    p[b1]=buf;
  }
  for(i=0;i<n;i++)printf("%d\n",p[i]);
}