#include<iostream>

using namespace std;

int main() {
	int a,b;
	char c;
	cin >> a >> b;
	int x[a];
	int m,n,p;
	for(int i = 0;i<a;i++){
		x[i] = i+1;
	}

	for(int j = 0;j<b;j++){
		cin >> n >> c >> m;
		m--;
		n--;
		p = x[m];
		x[m] = x[n];
		x[n] = p;
	}
	for(int k = 0;k<a;k++){
		cout << x[k] << endl;
	}


	return 0;
}

