#include <bits/stdc++.h>
using namespace std;

int main() {
	int w, n;
	cin >> w >> n;
	
	vector<int> v(w);
	for (int i = 0; i < w; i++) {
		v.at(i) = i + 1;
	}

	for (int i = 0; i < n; i++) {
		int a, b;
		char c;
		cin >> a >> c >> b;

		int n = v.at(a - 1);
		v.at(a - 1) = v.at(b - 1);
		v.at(b - 1) = n;
	}

	for (int i = 0; i < w; i++) {
		cout << v.at(i) << endl;
	}
}
