import java.util.*;

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

        w = sc.nextInt();
        n = sc.nextInt();
        amida = new int[w];
        for(int j=0;j<w;j++)
            amida[j]=j+1;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] sp = s.split(",");
            int c;
            int a=Integer.parseInt(sp[0]);
            int b=Integer.parseInt(sp[1]);
            c = amida[a-1];
            amida[a-1]=amida[b-1];
            amida[b-1]=c;
        }
        for(int k=0;k<w;k++){
            System.out.println(amida[k]);
        }


    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w, n;
        int[] amida;

        w = sc.nextInt();
        n = sc.nextInt();
        amida = new int[w];
        for(int j=0;j<w;j++)
            amida[j]=j+1;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] sp = s.split(",");
            int c;
            int a=Integer.parseInt(sp[0]);
            int b=Integer.parseInt(sp[1]);
            c = amida[a-1];
            amida[a-1]=amida[b-1];
            amida[b-1]=c;
        }
        for(int k=0;k<w;k++){
            System.out.println(amida[k]);
        }


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

        w = sc.nextInt();
        n = sc.nextInt();
        amida = new int[w];
        for(int j=0;j<w;j++)
            amida[j]=j+1;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] sp = s.split(",");
            int c;
            int a=Integer.parseInt(sp[0]);
            int b=Integer.parseInt(sp[1]);
            c = amida[a-1];
            amida[a-1]=amida[b-1];
            amida[b-1]=c;
        }
        for(int k=0;k<w;k++){
            System.out.println(amida[k]);
        }


    } main {
        Scanner sc = new Scanner(System.in);
        int w, n;
        int[] amida;

        w = sc.nextInt();
        n = sc.nextInt();
        amida = new int[w];
        for(int j=0;j<w;j++)
            amida[j]=j+1;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] sp = s.split(",");
            int c;
            int a=Integer.parseInt(sp[0]);
            int b=Integer.parseInt(sp[1]);
            c = amida[a-1];
            amida[a-1]=amida[b-1];
            amida[b-1]=c;
        }
        for(int k=0;k<w;k++){
            System.out.println(amida[k]);
        }


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

        w = sc.nextInt();
        n = sc.nextInt();
        amida = new int[w];
        for(int j=0;j<w;j++)
            amida[j]=j+1;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] sp = s.split(",");
            int c;
            int a=Integer.parseInt(sp[0]);
            int b=Integer.parseInt(sp[1]);
            c = amida[a-1];
            amida[a-1]=amida[b-1];
            amida[b-1]=c;
        }
        for(int k=0;k<w;k++){
            System.out.println(amida[k]);
        }


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

        w = sc.nextInt();
        n = sc.nextInt();
        amida = new int[w];
        for(int j=0;j<w;j++)
            amida[j]=j+1;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] sp = s.split(",");
            int c;
            int a=Integer.parseInt(sp[0]);
            int b=Integer.parseInt(sp[1]);
            c = amida[a-1];
            amida[a-1]=amida[b-1];
            amida[b-1]=c;
        }
        for(int k=0;k<w;k++){
            System.out.println(amida[k]);
        }


    }
} Main
import java.util.*;

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

        w = sc.nextInt();
        n = sc.nextInt();
        amida = new int[w];
        for(int j=0;j<w;j++)
            amida[j]=j+1;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] sp = s.split(",");
            int c;
            int a=Integer.parseInt(sp[0]);
            int b=Integer.parseInt(sp[1]);
            c = amida[a-1];
            amida[a-1]=amida[b-1];
            amida[b-1]=c;
        }
        for(int k=0;k<w;k++){
            System.out.println(amida[k]);
        }


    }
}

