#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main() {
	int num,a=0,b=0,draw;
	cin >> num;
	int *line = new int[num];
	for (int w = 0; w < num; w++) {
		line[w] = w + 1;
	}
		cin >> draw;
		for (int w = 0; w < draw; w++) {
			scanf("%d,%d", &a, &b);
			swap(line[a-1], line[b-1]);
		}
		for (int w = 0; w < num; w++) {
			cout<<line[w]<<endl;
		}
	return 0;
}
