import java.util.Scanner;
public class Main {
    public static void main(String[] args) {

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

        Scanner scan = new Scanner(System.in);
        int w,n;
        w = scan.nextInt();
        n = scan.nextInt();
        int[] x = new int[w];
        for(int i=0;i<w;i++){
            x[i]=i+1;
        }
        String str;
        String[] num = new String[2];
        int a,b;
        a=0;
        b=0;
        for(int i=0;i<n;i++){
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        }
        for(int i=0;i<w;i++){
            System.out.println(x[i]);
        }
    }
} Main public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int w,n;
        w = scan.nextInt();
        n = scan.nextInt();
        int[] x = new int[w];
        for(int i=0;i<w;i++){
            x[i]=i+1;
        }
        String str;
        String[] num = new String[2];
        int a,b;
        a=0;
        b=0;
        for(int i=0;i<n;i++){
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        }
        for(int i=0;i<w;i++){
            System.out.println(x[i]);
        }
    } main {

        Scanner scan = new Scanner(System.in);
        int w,n;
        w = scan.nextInt();
        n = scan.nextInt();
        int[] x = new int[w];
        for(int i=0;i<w;i++){
            x[i]=i+1;
        }
        String str;
        String[] num = new String[2];
        int a,b;
        a=0;
        b=0;
        for(int i=0;i<n;i++){
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        }
        for(int i=0;i<w;i++){
            System.out.println(x[i]);
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w w n; n w = scan.nextInt() w scan.nextInt() scan.nextInt scan n = scan.nextInt() n scan.nextInt() scan.nextInt scan int[] x = new int[w]; x new int[w] w for(int i=0;i<w;i++){
            x[i]=i+1;
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
            x[i]=i+1;
        } {
            x[i]=i+1;
        } x[i]=i+1 x[i] x i i+1 i 1 String str; str String[] num = new String[2]; num new String[2] 2 int a a b; b a=0 a 0 b=0 b 0 for(int i=0;i<n;i++){
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        } {
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        } str = scan.next() str scan.next() scan.next scan num =  str.split(",",0) num str.split(",",0) str.split str "," 0 a = Integer.parseInt(num[0]) a Integer.parseInt(num[0]) Integer.parseInt Integer num[0] num 0 b = Integer.parseInt(num[1]) b Integer.parseInt(num[1]) Integer.parseInt Integer num[1] num 1 a-- a b-- b int c = x[a]; c x[a] x a x[a]=x[b] x[a] x a x[b] x b x[b]=c x[b] x b c for(int i=0;i<w;i++){
            System.out.println(x[i]);
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
            System.out.println(x[i]);
        } {
            System.out.println(x[i]);
        } System.out.println(x[i]) System.out.println System.out System System.out x[i] x i String[] args args public class Main {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int w,n;
        w = scan.nextInt();
        n = scan.nextInt();
        int[] x = new int[w];
        for(int i=0;i<w;i++){
            x[i]=i+1;
        }
        String str;
        String[] num = new String[2];
        int a,b;
        a=0;
        b=0;
        for(int i=0;i<n;i++){
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        }
        for(int i=0;i<w;i++){
            System.out.println(x[i]);
        }
    }
} public class Main {
    public static void main(String[] args) {

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

        Scanner scan = new Scanner(System.in);
        int w,n;
        w = scan.nextInt();
        n = scan.nextInt();
        int[] x = new int[w];
        for(int i=0;i<w;i++){
            x[i]=i+1;
        }
        String str;
        String[] num = new String[2];
        int a,b;
        a=0;
        b=0;
        for(int i=0;i<n;i++){
            str = scan.next();
            num =  str.split(",",0);
            a = Integer.parseInt(num[0]);
            b = Integer.parseInt(num[1]);
            a--;
            b--;
            int c = x[a];
            x[a]=x[b];
            x[b]=c;
        }
        for(int i=0;i<w;i++){
            System.out.println(x[i]);
        }
    }
}
