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


int main()
{
	int w, n, A, B;
	int a[30], b[30][2];
	cin >> w >> n;
	for (int i = 0;i < w; i++) {
		a[i] = i + 1;
	}
	for (int j = 0;j < n;j++) {
		scanf("%d,%d", &b[j][0], &b[j][1]);
		A = a[b[j][0]-1], B = a[b[j][1]-1];
		a[b[j][0]-1] = B, a[b[j][1]-1] = A;
	}
	for (int k = 0;k < w;k++) {
		cout << a[k] << endl;
	}

    return 0;
}


