import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int[] am = new int[32];
        int n,i,w,a,b,t;
        String st;
        String[] x;
        w = s.nextInt();
        n = s.nextInt();
        for(i=1;i<=w;i++)am[i]=i;
        for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        }
        for(i=1;i<=w;i++)System.out.println(am[i]);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int[] am = new int[32];
        int n,i,w,a,b,t;
        String st;
        String[] x;
        w = s.nextInt();
        n = s.nextInt();
        for(i=1;i<=w;i++)am[i]=i;
        for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        }
        for(i=1;i<=w;i++)System.out.println(am[i]);
    }
} Main public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int[] am = new int[32];
        int n,i,w,a,b,t;
        String st;
        String[] x;
        w = s.nextInt();
        n = s.nextInt();
        for(i=1;i<=w;i++)am[i]=i;
        for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        }
        for(i=1;i<=w;i++)System.out.println(am[i]);
    } main {
        Scanner s = new Scanner(System.in);
        int[] am = new int[32];
        int n,i,w,a,b,t;
        String st;
        String[] x;
        w = s.nextInt();
        n = s.nextInt();
        for(i=1;i<=w;i++)am[i]=i;
        for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        }
        for(i=1;i<=w;i++)System.out.println(am[i]);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int[] am = new int[32]; am new int[32] 32 int n n i i w w a a b b t; t String st; st String[] x; x w = s.nextInt() w s.nextInt() s.nextInt s n = s.nextInt() n s.nextInt() s.nextInt s for(i=1;i<=w;i++)am[i]=i; i=1; i=1 i 1 i<=w i w i++ i++ i am[i]=i; am[i]=i am[i] am i i for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        } i=1; i=1 i 1 i<=n i n i++ i++ i {
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        } {
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        } st = s.next() st s.next() s.next s x = st.split(",") x st.split(",") st.split st "," a = Integer.parseInt(x[0]) a Integer.parseInt(x[0]) Integer.parseInt Integer x[0] x 0 b = Integer.parseInt(x[1]) b Integer.parseInt(x[1]) Integer.parseInt Integer x[1] x 1 t = am[a] t am[a] am a am[a] = am[b] am[a] am a am[b] am b am[b] = t am[b] am b t for(i=1;i<=w;i++)System.out.println(am[i]); i=1; i=1 i 1 i<=w i w i++ i++ i System.out.println(am[i]); System.out.println(am[i]) System.out.println System.out System System.out am[i] am i String[] args args public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int[] am = new int[32];
        int n,i,w,a,b,t;
        String st;
        String[] x;
        w = s.nextInt();
        n = s.nextInt();
        for(i=1;i<=w;i++)am[i]=i;
        for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        }
        for(i=1;i<=w;i++)System.out.println(am[i]);
    }
} public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int[] am = new int[32];
        int n,i,w,a,b,t;
        String st;
        String[] x;
        w = s.nextInt();
        n = s.nextInt();
        for(i=1;i<=w;i++)am[i]=i;
        for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        }
        for(i=1;i<=w;i++)System.out.println(am[i]);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int[] am = new int[32];
        int n,i,w,a,b,t;
        String st;
        String[] x;
        w = s.nextInt();
        n = s.nextInt();
        for(i=1;i<=w;i++)am[i]=i;
        for(i=1;i<=n;i++){
            st = s.next();
            x = st.split(",");
            a = Integer.parseInt(x[0]);
            b = Integer.parseInt(x[1]);
            t = am[a];
            am[a] = am[b];
            am[b] = t;
        }
        for(i=1;i<=w;i++)System.out.println(am[i]);
    }
}
