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

int main()
{
	int w, n, wn[30];

	cin >> w >> n;
	for (int i = 0; i < w; ++i)
	{
		wn[i] = i + 1;
	}
	for (int i = 0; i < n; ++i)
	{
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(wn[a - 1], wn[b - 1]);
	}
	for (int i = 0; i < w; ++i)
	{
		cout << wn[i] << endl;
	}
	return 0;
}