Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	w := nextInt()
	n := nextInt()

	numbers := make([]int, w+1)
	for i := 1; i <= w; i++ {
		numbers[i] = i
	}

	for i := 0; i < n; i++ {
		line := nextString()
		words := strings.Split(line, ",")
		a, _ := strconv.Atoi(words[0])
		b, _ := strconv.Atoi(words[1])

		numbers[a], numbers[b] = numbers[b], numbers[a]
	}

	for i := 1; i <= w; i++ {
		fmt.Println(numbers[i])
	}
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

void out1(vector<int> a) {
	for (size_t i = 0; i < a.size(); i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}

int main() {
	int w, n;
	cin >> w;	// ???????????°
	cin >> n;	// ?¨?????????°
	vector<int> begin(n);
	vector<int> end(n);
	vector<int> location(w);
	int num1 = 0;
	int num2 = 0;

	// ??\???
	for (size_t i = 0; i < n; i++)
	{
		scanf("%d,%d", &begin[i], &end[i]);
	}

	// location????????????
	for (size_t i = 0; i < w; i++)
	{
		location[i] = i + 1;
		
	}
	
	// ????????\??¬????????§????????????
	for (size_t i = 0; i < w; i++)
	{
		vector<int> tmp(w,0);
		//out1(tmp);
		tmp[i] = location[i];
		//cout << "----i = " << i << "?????¨???----" << endl;
		for (size_t j = 0; j < n; j++)
		{
			if (begin[j] == location[i])
			{
				
				//cout << begin[j] << "???" << end[j] << "?????\???????????????" << endl;
				location[i] = end[j];
			}
			else if (end[j] == location[i])
			{
				//cout << end[j] << "???" << begin[j] << "?????\???????????????" << endl;
				location[i] = begin[j];
			}
			//out1(location);
		}
	}
	// ???????????????
	vector<int> output(w,0);
	for (size_t i = 0; i < w; i++)
	{
		output[location[i]-1] = i;
	}

	// ???????????¨???????????????????????°??????1????¶????
	for (size_t i = 0; i < w; i++)
	{
		cout << output[i]+1 << endl;
	}


	return 0;
}

C++: #include<stdio.h>

int main(){

int x[32][2]={};
int w,n;

scanf("%d",&w);
scanf("%d",%n);
for(int i=0;i<=w;i++)
x[i][0]=i;

for(int i=0;i<n;i++)
{
int a1,a2;
scanf("%d,%d",&a1,&a2);
int t=x[a1][0];x[a1][0]=x[a2][0];x[a2][0]=t;
}

for(int i=1;i<=w;i++)
printf("%d\n",x[i][0]);

return 0;
}

C++: #include<stdio.h>

int main(){
	int tate,yoko,bou[30][2],j,x,kekka[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30},i=0;
	scanf("%d %d",&tate,&yoko);
	for(j=0;j<yoko;j++){
		scanf("%d",&bou[i][1]);
		printf(",");
		scanf("%d",&bou[i][2]);
	}
	for(i=0;i<tate;i++){
		x=i;
		for(j=0;j<yoko;j++){
			if(bou[j][1]==x){
				x=bou[j][2];
			}
			else if(bou[j][2]==x){
				x=bou[j][1];
			}
		}
		kekka[x-1]=i;
	}
	for(j=0;j<tate;j++){
		printf("%d\n",kekka[j]);
	}
}

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

//0011
int main(){
	int w, n;

	int a[30]={0};
	for(int i=0; i<30; ++i){
		a[i] = i+1;
	}

	cin >> w >> n;
	for(int i=0; i<n; ++i){
		pair<int,int> p;
		char comma;
		cin >> p.first >> comma >> p.second;

		//swap		
		int temp = a[p.first-1];
		a[p.first-1] = a[p.second-1];
		a[p.second-1]= temp;
	}

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

C++: #include <iostream>

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int w, s[31], n, a, b;
    cin >> w >> n;
    for(int i=1; i<=w; i++){
        s[i]=i;
    }
    while(n--){
        scanf("%d,%d", &a, &b);
        swap(s[a], s[b]);
    }
    for(int i=1; i<=w; i++){
        cout << s[i] << "\n";
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

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

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

using namespace::std;

int main(){

	int w;
	int n;
	int i;
	int a;
	int b;
	int number[32] = {};

	scanf("%d", &w);
	scanf("%d", &n);

	for (i = 1; i <= w; i++){
		number[i] = i;
	}

	for (i = 0; i < n; i++){
		scanf("%d,%d", &a, &b);
		swap(number[a], number[b]);
	}
	for (i = 1; i <= w; i++){
		cout << number[i] << endl;
	}


	return 0;
}

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

auto main () -> int
{
    int amida [31];
    
    int w;
    std::cin >> w;
    for (auto i = 1; i <= w; ++ i)
    {
        amida [i] = i;
    }

    int n;
    std::cin >> n;
    for (auto i = 0; i < n; ++ i)
    {
        int a , b;
        std::scanf ("%d,%d" , & a , & b);
        std::swap (amida [a] , amida [b]);
    }

    for (auto i = 1; i <= w; ++ i)
    {
        std::cout << amida [i] << std::endl;
    }
}

C++: //↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑


int main() {
	int a, b, k[35], l[35];
	cin >> a >> b;
	vector<int>ans(a);
	char c;
	for (int i = 0; i < a; ++i) { ans[i] = 1 + i; }
	for (int i = 0; i < b; ++i) { cin >> k[i] >> c >> l[i]; swap(ans[k[i] - 1], ans[l[i] - 1]); }
	for (auto i : ans) { cout << i << endl; }
}