#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int n,m;
	int row[30];
	cin >>n>>m;
	for(int i=0; i<n; i++){row[i] = i+1;}
	for(int i=0; i<m; i++){
		int a,b;
		scanf("%d,%d",&a,&b);
		int c = row[a-1];
		row[a-1] = row[b-1];
		row[b-1] = c;
	}
	for(int i=0; i<n; i++){cout <<row[i]<<endl;}
	return 0;
}