#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main(void)
{
	int w, n, l, r;
	char sep;

	cin >> w >> n;

	vector<int> a;
	for (int i = 0; i < w; i++) a.push_back(i+1);

	for (int i = 0; i < n; i++) {
		cin >> l >> sep >> r;
		swap(a[l-1], a[r-1]);
	}

	for (int i = 0; i < w; i++)
		cout << a[i] << endl;

	return 0;
}
