import java.util.Scanner;


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

        for(int i=0;i<w;i++){

            num[i]=i+1;

        }
        sc.useDelimiter(",|\n");
        for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        }



        for(int i=0;i<w;i++){

            System.out.println(num[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 w =sc.nextInt();
        int n=sc.nextInt();
        
        int[] num;
        num=new int[w];

        for(int i=0;i<w;i++){

            num[i]=i+1;

        }
        sc.useDelimiter(",|\n");
        for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        }



        for(int i=0;i<w;i++){

            System.out.println(num[i]);
        }

        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        
        int w =sc.nextInt();
        int n=sc.nextInt();
        
        int[] num;
        num=new int[w];

        for(int i=0;i<w;i++){

            num[i]=i+1;

        }
        sc.useDelimiter(",|\n");
        for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        }



        for(int i=0;i<w;i++){

            System.out.println(num[i]);
        }

        sc.close();
    } main {
        Scanner sc =new Scanner(System.in);
        
        int w =sc.nextInt();
        int n=sc.nextInt();
        
        int[] num;
        num=new int[w];

        for(int i=0;i<w;i++){

            num[i]=i+1;

        }
        sc.useDelimiter(",|\n");
        for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        }



        for(int i=0;i<w;i++){

            System.out.println(num[i]);
        }

        sc.close();
    } Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int w =sc.nextInt(); w sc.nextInt() sc.nextInt sc int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] num; num num=new int[w] num new int[w] w for(int i=0;i<w;i++){

            num[i]=i+1;

        } int i=0; int i=0; i 0 i<w i w i++ i++ i {

            num[i]=i+1;

        } {

            num[i]=i+1;

        } num[i]=i+1 num[i] num i i+1 i 1 sc.useDelimiter(",|\n") sc.useDelimiter sc ",|\n" for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        } {

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        } String str=sc.nextLine(); str sc.nextLine() sc.nextLine sc int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int temp = num[a-1]; temp num[a-1] num a-1 a 1 num[a-1] = num[b-1] num[a-1] num a-1 a 1 num[b-1] num b-1 b 1 num[b-1] = temp num[b-1] num b-1 b 1 temp for(int i=0;i<w;i++){

            System.out.println(num[i]);
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {

            System.out.println(num[i]);
        } {

            System.out.println(num[i]);
        } System.out.println(num[i]) System.out.println System.out System System.out num[i] num 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 w =sc.nextInt();
        int n=sc.nextInt();
        
        int[] num;
        num=new int[w];

        for(int i=0;i<w;i++){

            num[i]=i+1;

        }
        sc.useDelimiter(",|\n");
        for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        }



        for(int i=0;i<w;i++){

            System.out.println(num[i]);
        }

        sc.close();
    }
} public class Main{
   
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        
        int w =sc.nextInt();
        int n=sc.nextInt();
        
        int[] num;
        num=new int[w];

        for(int i=0;i<w;i++){

            num[i]=i+1;

        }
        sc.useDelimiter(",|\n");
        for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        }



        for(int i=0;i<w;i++){

            System.out.println(num[i]);
        }

        sc.close();
    }
} Main
import java.util.Scanner;


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

        for(int i=0;i<w;i++){

            num[i]=i+1;

        }
        sc.useDelimiter(",|\n");
        for(int i=0;i<n;i++){

           String str=sc.nextLine();
           int a = sc.nextInt();
			int b = sc.nextInt();
           int temp = num[a-1];
           num[a-1] = num[b-1];
           num[b-1] = temp;
            
        }



        for(int i=0;i<w;i++){

            System.out.println(num[i]);
        }

        sc.close();
    }
}
