
import java.util.Scanner;

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

        while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        }
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        } sc.hasNext() sc.hasNext sc {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

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

        while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        }
    }
} Main

import java.util.Scanner;

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

        while (sc.hasNext()) {
            int i = 0;
            int w = sc.nextInt();
            int n = sc.nextInt();
            String rem;
            int[] array;
            array = new int[w];

            for (i = 0; i < w; i++) {
                array[i] = i + 1;
            }

            for (i = 0; i < n; i++) {
                rem = sc.next();
                String[] swap = rem.split(",");
                int a = Integer.parseInt(swap[0]) - 1;
                int b = Integer.parseInt(swap[1]) - 1;
                int temp = 0;
                temp = array[a];
                array[a] = array[b];
                array[b] = temp;
            }
            for (i = 0; i < w; i++) {
                System.out.println(array[i]);
            }
        }
    }
}

