import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
}
}
 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
}
} Main public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
} main {
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
} Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int n n m; m n=sc.nextInt() n sc.nextInt() sc.nextInt sc int []x =new int [n]; x new int [n] n for(int j=0;j<x.length;j++){
			x[j]=j+1;
        } int j=0; int j=0; j 0 j<x.length j x.length x x.length j++ j++ j {
			x[j]=j+1;
        } {
			x[j]=j+1;
        } x[j]=j+1 x[j] x j j+1 j 1 m=sc.nextInt() m sc.nextInt() sc.nextInt sc for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        } int i=0; int i=0; i 0 i<m i m i++ i++ i {
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        } {
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        } String h =sc.next(); h sc.next() sc.next sc String []s = h.split(","); s h.split(",") h.split h "," int a =Integer.parseInt(s[0])-1; a Integer.parseInt(s[0])-1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 int b =Integer.parseInt(s[1])-1; b Integer.parseInt(s[1])-1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 int p; p p=x[a] p x[a] x a x[a]=x[b] x[a] x a x[b] x b x[b]=p x[b] x b p for(int k=0;k<n;k++){
        System.out.println(x[k]);
    } int k=0; int k=0; k 0 k<n k n k++ k++ k {
        System.out.println(x[k]);
    } {
        System.out.println(x[k]);
    } System.out.println(x[k]) System.out.println System.out System System.out x[k] x k String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
}
} public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
}
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
}
}

