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<iostream>
#include<cstdio>
using namespace std;

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


}

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

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

C++: #include <iostream>

using namespace std;

int main(){
	int w, n;
	cin >> w >> n;
	int s[w];

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

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

		int tmp = s[a-1];
		s[a-1] = s[b-1];
		s[b-1] = tmp;
	}

	for(int i=0; i<w; i++){
		cout << s[i] << "\n";
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

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

C++: #include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cstdlib>

using namespace std;

int main(){
	int widthCount = 0, heightCount = 0;
	string tmp;

	cin >> widthCount >> heightCount;

	vector<int> width(widthCount);
	for(int i = 0; i < widthCount; i++){
		width[i] = i + 1;
	}
	
	pair<int,int> height;
	/*height.first = vector<int>(heightCount,0);
	height.second = vector<int>(heightCount,0);*/

	char *a = new char[4];
	char *tp;

	for(int i = 0; i < heightCount; i++){
		cin >> tmp;
		
		strcpy(a,tmp.c_str());
		
		tp = strtok(a,",");
		height.first = atoi(tp);
		tp = strtok(NULL,",");
		height.second = atoi(tp);

		swap(width[height.first - 1],width[height.second - 1]);

	}

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

	return 0;
}

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

int main() {
	int w, n, i, z, a, b;
	cin >> w >> n;
	vector<int> A(w);
	for (i = 0; i < w; i++) A[i] = i + 1;
	for (i = 0; i < n; i++) {
		scanf("%d,%d", &a, &b);
		z = A[a - 1];
		A[a-1] = A[b-1]; A[b-1] = z;
	}
	for (i = 0; i < w; i++) cout << A[i] << endl;
	return 0;
}

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

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int amida[33];
    for (int i = 0; i <= 31; ++i)
        amida[i] = i;
    int w, n;
    int a, b;
    std::string s;
    std::cin >> w;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> s;
        a = s.at(0) - '0';
        b = s.at(2) - '0';
        amida[32] = amida[a];
        amida[a] = amida[b];
        amida[b] = amida[32];
    }
    for (int i = 1; i <= w; ++i)
        std::cout << amida[i] << std::endl;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define all(c) (c).begin(), (c).end()

using namespace std;
template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, T b) { if(b < a) a = b; }

int main() {
	int W,N;
	vector<int> nums;

	cin >> W;
	rep(i,W) {
		nums.push_back(i+1);
		//cout << i+1;
	}
	//cout << endl;

	string a_str;
	cin >> N;
	rep(i,N) {
		cin >> a_str;
		int left = a_str[0] - '0';
		int right = a_str[2] - '0';
		int tmp = nums[left-1];
		nums[left-1] = nums[right-1];
		nums[right-1] = tmp;
	}
	rep(i,nums.size()) {
		cout << nums[i] << endl;
	}

	return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
#define MAX 30
using namespace std;

int main(void)
{
	int lot[MAX], w, n;
	cin >> w >> n;
	for (int i = 0; i < w; i++) lot[i] = i+1;
	for (int i = 0; i < n; i++) {
		int a, b, tmp;
		scanf("%d,%d", &a, &b);
		tmp = lot[a-1];
		lot[a-1] = lot[b-1];
		lot[b-1] = tmp;
	}
	for (int i = 0; i < w; i++) cout << lot[i] << endl;
	
	return 0;
}

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

using namespace std;

int main() {
    int W, N;
    cin >> W >> N;

    vector<int> v;
    for(int i = 1; i <= W; ++i) v.push_back(i);
    while(N--) {
        int a, b;
        char c;
        cin >> a >> c >> b;
        swap(v[a-1], v[b-1]);
    }
    for(int i = 0; i < v.size(); ++i) cout << v[i] << endl;
    return 0;
}

C++: #include <stdlib.h>

#include <string>
#include <vector>
#include <algorithm>
#include <iostream>

/*
Drawing Lots

º}Ìæ¤È¢íÉ­¶ª èÜ·B±ÌáÅÍcüÌªT{ èAS{Ì¡üªø©êÄ¢Ü·B¡üÍcüðÜ½¢Åàæ¢ÆµÜ·B

}ÌãÅÍ 1, 2, 3, 4, 5 ÌÔÅ Á½àÌªAQÔÚÆSÔÚÌÔÅÌð·i±êð (2, 4) Ìæ¤É­jðµA³çÉA(3, 5)(1, 2)(3, 4) Ìð·ðµ½ÌÅA}ÌºÉ½Æ«ÍA4, 1, 2, 5, 3 ÉÈèÜµ½B

ÅÌóÔ@1, 2, 3, 4.... ªA^¦çê½¡_ÌXgi±ÌáÅÍA(2, 4)(3, 5)(1, 2)(3, 4) ðÊßµ½Ì¿AÇÌæ¤ÈÔÉÈé©ðoÍµÄI¹·évOðì¬µÄº³¢B
Input

cüÌ{ w (®Fw  30)
¡_Ì{ n (®Fn  30)
¡_Xg a1, b1 (®F¼pJ}æØè) ¡_Xg a2, b2 (®F¼pJ}æØè) .
.
.
¡_Xg an, bn (®F¼pJ}æØè)
Output

¶©çEÉA
1 ÔÚÌ_Éé
2 ÔÚÌ_Éé
.
.
w ÔÚÌ_Éé
Sample Input

5
4
2,4
3,5
1,2
3,4

Output for the Sample Input

4
1
2
5
3

*/

using namespace std;

void swap(int *a, int *b)
{
	int t = *a;
	*a = *b;
	*b = t;
}

int main()
{
	string s;
	int w, n;

	getline(cin, s);
	sscanf(s.c_str(), "%ld", &w);
	getline(cin, s);
	sscanf(s.c_str(), "%ld", &n);
	
	vector<int> v;
	for (int i = 0; i < w; i++)
	{
		v.push_back(i + 1);
	}
	
	for (int i = 0; i < n; i++)
	{
		int a, b;
		getline(cin, s);
		sscanf(s.c_str(), "%ld,%ld", &a, &b);
		swap(&v[a - 1], &v[b - 1]);
	}
	
	for (int i = 0; i < w; i++)
	{
		printf("%d\n", v[i]);
	}

	return 0;
}