import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    }
} Main public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    } main {
        Scanner sc=new Scanner(System.in);

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int i; i int swap; swap int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] numarr=new int[n]; numarr new int[n] n for(i=0;i<n;i++){
            numarr[i]=i+1;
        } i=0; i=0 i 0 i<n i n i++ i++ i {
            numarr[i]=i+1;
        } {
            numarr[i]=i+1;
        } numarr[i]=i+1 numarr[i] numarr i i+1 i 1 int m=sc.nextInt(); m sc.nextInt() sc.nextInt sc for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        } i=0; i=0 i 0 i<m i m i++ i++ i {
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        } {
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        } String str=sc.next(); str sc.next() sc.next sc String[] inte=str.split(",",0); inte str.split(",",0) str.split str "," 0 int a=Integer.parseInt(inte[0])-1; a Integer.parseInt(inte[0])-1 Integer.parseInt(inte[0]) Integer.parseInt Integer inte[0] inte 0 1 int b=Integer.parseInt(inte[1])-1; b Integer.parseInt(inte[1])-1 Integer.parseInt(inte[1]) Integer.parseInt Integer inte[1] inte 1 1 swap=numarr[a] swap numarr[a] numarr a numarr[a]=numarr[b] numarr[a] numarr a numarr[b] numarr b numarr[b]=swap numarr[b] numarr b swap for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        } i=0; i=0 i 0 i<n i n i++ i++ i {
            System.out.println(numarr[i]);
        } {
            System.out.println(numarr[i]);
        } System.out.println(numarr[i]) System.out.println System.out System System.out numarr[i] numarr i sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);

        int i;
        int swap;

        int n=sc.nextInt();
        int[] numarr=new int[n];
        for(i=0;i<n;i++){
            numarr[i]=i+1;
        }
        int m=sc.nextInt();
        
        for(i=0;i<m;i++){
            String str=sc.next();
            String[] inte=str.split(",",0);
            int a=Integer.parseInt(inte[0])-1;
            int b=Integer.parseInt(inte[1])-1;
            swap=numarr[a];
            numarr[a]=numarr[b];
            numarr[b]=swap;
        }
        
        for(i=0;i<n;i++){
            System.out.println(numarr[i]);
        }
        sc.close();
    }
}
