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

int set(int *arr, int n){
	for(int i = 1; i <= n; i++){
		arr[i] = i;
	}
}

int main(){
	int arr[50];
	int a, b;
	cin >> a >> b;
	set(arr, a);
	int x, y;
	for(int i = 0; i < b; i++){
		scanf("%d,%d", &x, &y);
		int temp = arr[x];
		arr[x] = arr[y];
		arr[y] = temp;
	}
	for(int i = 1; i <= a; i++){
		cout << arr[i] << endl;
	}
}
