import java.util.Scanner;

class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in).useDelimiter("[,\\s]+");

        int w = scanner.nextInt();
        int n = scanner.nextInt();
        int[] number = new int[w + 1];
        for (int i = 1; i <= w; i++) {
            number[i] = i;
        }
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        }
        for (int i = 1; i <= w; i++) {
            System.out.println(number[i]);
        }
    }

    public static void main(String... args) {
        solve();
    }
} import java.util.Scanner; Scanner java.util class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in).useDelimiter("[,\\s]+");

        int w = scanner.nextInt();
        int n = scanner.nextInt();
        int[] number = new int[w + 1];
        for (int i = 1; i <= w; i++) {
            number[i] = i;
        }
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        }
        for (int i = 1; i <= w; i++) {
            System.out.println(number[i]);
        }
    }

    public static void main(String... args) {
        solve();
    }
} Main private static void solve() {
        Scanner scanner = new Scanner(System.in).useDelimiter("[,\\s]+");

        int w = scanner.nextInt();
        int n = scanner.nextInt();
        int[] number = new int[w + 1];
        for (int i = 1; i <= w; i++) {
            number[i] = i;
        }
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        }
        for (int i = 1; i <= w; i++) {
            System.out.println(number[i]);
        }
    } solve {
        Scanner scanner = new Scanner(System.in).useDelimiter("[,\\s]+");

        int w = scanner.nextInt();
        int n = scanner.nextInt();
        int[] number = new int[w + 1];
        for (int i = 1; i <= w; i++) {
            number[i] = i;
        }
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        }
        for (int i = 1; i <= w; i++) {
            System.out.println(number[i]);
        }
    } Scanner scanner = new Scanner(System.in).useDelimiter("[,\\s]+"); scanner new Scanner(System.in).useDelimiter("[,\\s]+") new Scanner(System.in).useDelimiter new Scanner(System.in) "[,\\s]+" int w = scanner.nextInt(); w scanner.nextInt() scanner.nextInt scanner int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] number = new int[w + 1]; number new int[w + 1] w + 1 w 1 for (int i = 1; i <= w; i++) {
            number[i] = i;
        } int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
            number[i] = i;
        } {
            number[i] = i;
        } number[i] = i number[i] number i i for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        } {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        } int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int temp = number[a]; temp number[a] number a number[a] = number[b] number[a] number a number[b] number b number[b] = temp number[b] number b temp for (int i = 1; i <= w; i++) {
            System.out.println(number[i]);
        } int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
            System.out.println(number[i]);
        } {
            System.out.println(number[i]);
        } System.out.println(number[i]) System.out.println System.out System System.out number[i] number i public static void main(String... args) {
        solve();
    } main {
        solve();
    } solve() solve String... args args
import java.util.Scanner;

class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in).useDelimiter("[,\\s]+");

        int w = scanner.nextInt();
        int n = scanner.nextInt();
        int[] number = new int[w + 1];
        for (int i = 1; i <= w; i++) {
            number[i] = i;
        }
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int temp = number[a];
            number[a] = number[b];
            number[b] = temp;
        }
        for (int i = 1; i <= w; i++) {
            System.out.println(number[i]);
        }
    }

    public static void main(String... args) {
        solve();
    }
}