


#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	int n, m;
	int ver[31];
	scanf("%d", &n);
	scanf("%d", &m);
	for (int i = 0; i < n; i++) {
		ver[i] = i + 1;
	}
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d,%d", &x, &y);
		swap(ver[x-1], ver[y-1]);
	}
	for (int i = 0; i < n; i++) {
		printf("%d\n", ver[i]);
	}
	return 0;
}