#include<iostream>
using namespace std;
int main(){
	int w, n, a[100] = { 0 },b,d,A=0;
	char c;
	cin >> w, n;
	for (int i = 1; i <= w; i++){
		a[i] = i;
	}
	for (int i = 1; i <= n; i++){
		A = 0;
		cin >> b, c, d;
		A = a[b];
		a[b] = a[c];
		a[c] = A;
	}
	for (int i = 1; i <= w; i++){
		cout << a[i] << endl;
	}
	return 0;
}