#include <stdio.h>
int main(){
    int w[30],work,tate,yoko,i,i2,memo;
    int a1,a2;
    scanf("%d",&tate);
    scanf("%d",&yoko);
    for(i=0;i<tate;i++){
        w[i]=i+1;
    }
    for(i=1;i<=yoko;i++){
        scanf("%d,%d",&a1,&a2);
        for(i2=1;i2<=tate;i2++){
            if(i2==a1){
                work=w[i2-1];
                memo=i2-1;
            }
            if(i2==a2){
                w[memo]=w[i2-1];
                w[i2-1]=work;
            }
        }
    }
    for(i=0;i<tate;i++){
        printf("%d\n",w[i]);
    }
    
	return 0;
}