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

int main() {
	vector<int>v;
	vector<int>::iterator pv=v.begin();
	int w, n;
	scanf("%d,%d", &w, &n);
	for (int i = 0; i < w; i++) {
		v.push_back(i + 1);
	}
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(v[a - 1], v[b - 1]);
	}
	for (int i = 0; i < w; i++) {
		cout << *pv << endl;
		pv++;
	}
	return 0;
}