#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	int w, n;
	cin >> w >> n;

	vector<int> tate(w);

	for (int i = 0; i < w; ++i) {
		tate[i] = i + 1;
	}

	for (int i = 0; i < n; ++i) {
		int a, b;
		cin >> a;
		cin.ignore(1);
		cin >> b;

		swap(tate[a - 1], tate[b - 1]);
	}

	for (auto temp : tate) {
		cout << temp << endl;
	}

}