#include <bits/stdc++.h>
using namespace std;
long gcd(long n,long m){
	if (m == 0) return n;
	return gcd(m, n % m);
}

long lcm(long n, long m) {
	return m / gcd(n, m)*n;
}

int main(void) {
	int w, n, a, b, tmp;
	int ans[30];
	for (int i = 0; i < 30; i++)
		ans[i] = i + 1;
	scanf("%d\n%d", &w, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d,%d", &a, &b);
		tmp = ans[a - 1];
		ans[a - 1] = ans[b - 1];
		ans[b - 1] = tmp;
	}
	for (int i = 0; i < w; i++)
		cout << ans[i] << endl;
	return 0;
}
