import java.io.*;
 
public class Main{
    public static void main(String[] args){
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz