#include<iostream>
#include<stdio.h>
using namespace std;

class Amida{
public:
	void shokika(int a[],int b);
	void irekae(int bou[], int a, int b);
	void show(int bou[], int a);
};

void Amida::shokika(int a[],int b){
	for (int i = 0; i < b; i++){
		a[i] = i+1;
	}
}

void Amida::irekae(int bou[], int a, int b){
	int work;
	work = bou[a-1];
	bou[a-1] = bou[b-1];
	bou[b-1] = work;
}

void Amida::show(int bou[], int a){
	for (int i = 0; i < a; i++){
		cout << bou[i] << endl;
	}
}

int main(){
	int tate, yoko, *tatebou;
	Amida ami;
	cin >> tate >> yoko;

	tatebou = new int[tate];
	ami.shokika(tatebou, tate);

	int a, b;
	for (int i = 0; i < yoko; i++){
		scanf("%d,%d", &a, &b);
		ami.irekae(tatebou, a, b);
	}

	ami.show(tatebou,tate);

	return 0;
}
