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[] a=new int[w];
        for(int i=0;i<a.length;i++){
            a[i]=i+1;
        }
        for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        }
        for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        }
    }
} 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[] a=new int[w];
        for(int i=0;i<a.length;i++){
            a[i]=i+1;
        }
        for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        }
        for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        }
    }
} Main public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int w=sc.nextInt();
        int n=sc.nextInt();
        int[] a=new int[w];
        for(int i=0;i<a.length;i++){
            a[i]=i+1;
        }
        for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        }
        for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        }
    } main {
        Scanner sc=new Scanner(System.in);
        int w=sc.nextInt();
        int n=sc.nextInt();
        int[] a=new int[w];
        for(int i=0;i<a.length;i++){
            a[i]=i+1;
        }
        for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        }
        for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        }
    } 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[] a=new int[w]; a new int[w] w for(int i=0;i<a.length;i++){
            a[i]=i+1;
        } int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
            a[i]=i+1;
        } {
            a[i]=i+1;
        } a[i]=i+1 a[i] a i i+1 i 1 for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        } int j=0; int j=0; j 0 j<n j n j++ j++ j {
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        } {
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        } String str=sc.next(); str sc.next() sc.next sc String[] bc=str.split(","); bc str.split(",") str.split str "," int b=Integer.parseInt(bc[0])-1; b Integer.parseInt(bc[0])-1 Integer.parseInt(bc[0]) Integer.parseInt Integer bc[0] bc 0 1 int c=Integer.parseInt(bc[1])-1; c Integer.parseInt(bc[1])-1 Integer.parseInt(bc[1]) Integer.parseInt Integer bc[1] bc 1 1 int x=a[b]; x a[b] a b a[b]=a[c] a[b] a b a[c] a c a[c]=x a[c] a c x for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        } int k=0; int k=0; k 0 k<a.length k a.length a a.length k++ k++ k {
            System.out.println(a[k]);
        } {
            System.out.println(a[k]);
        } System.out.println(a[k]) System.out.println System.out System System.out a[k] a k 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[] a=new int[w];
        for(int i=0;i<a.length;i++){
            a[i]=i+1;
        }
        for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        }
        for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int w=sc.nextInt();
        int n=sc.nextInt();
        int[] a=new int[w];
        for(int i=0;i<a.length;i++){
            a[i]=i+1;
        }
        for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        }
        for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        }
    }
} 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[] a=new int[w];
        for(int i=0;i<a.length;i++){
            a[i]=i+1;
        }
        for(int j=0;j<n;j++){
            String str=sc.next();
            String[] bc=str.split(",");
            int b=Integer.parseInt(bc[0])-1;
            int c=Integer.parseInt(bc[1])-1;
            int x=a[b];
            a[b]=a[c];
            a[c]=x;
        }
        for(int k=0;k<a.length;k++){
            System.out.println(a[k]);
        }
    }
}
