#include <cstdio>
#include <vector>
#include <algorithm>

int main()
{
	int linecount = 0;
	std::scanf("%d", &linecount);

	std::vector<int> result(linecount);
	for (int i = 0; i < linecount; ++i) {
		result[i] = i + 1;
	}

	int swapcount = 0;
	std::scanf("%d", &swapcount);
	for (int i = 0; i < swapcount; ++i) {
		int swap1, swap2;
		if (std::scanf("%d,%d", &swap1, &swap2) == 2) {
			std::swap(result[swap1 - 1], result[swap2 - 1]);
		}
	}

	for (int i = 0; i < linecount; ++i) {
		std::printf("%d\n", result[i]);
	}

	return 0;
}