#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
	int w, n, cp, amd[30] = {0}, yoko[2];
	
	cin >> w >> n;

	for(int i = 1; i <= w; i++)
		amd[i-1] = i;

	for(int i = 0; i < n; i++){
		scanf("%d,%d", &yoko[0], &yoko[1]);

		cp = amd[yoko[0]-1];
		amd[yoko[0]-1] = amd[yoko[1]-1];
		amd[yoko[1]-1] = cp;
	}

	for(int i = 0; i < w; i++)
		cout << amd[i] << endl;
	
	return 0;
}