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