import java.lang.System;
import java.lang.Exception;
import java.util.Scanner;

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

        int w = sc.nextInt();
        int[] ans = new int[w];
        for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        }

        // 並び替え
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        }

        // 並び替え結果の出力
        for (int answer: ans) {
            System.out.println(answer);
        }
    }
} import java.lang.System; System java.lang import java.lang.Exception; Exception java.lang import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in).useDelimiter("\\D");

        int w = sc.nextInt();
        int[] ans = new int[w];
        for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        }

        // 並び替え
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        }

        // 並び替え結果の出力
        for (int answer: ans) {
            System.out.println(answer);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in).useDelimiter("\\D");

        int w = sc.nextInt();
        int[] ans = new int[w];
        for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        }

        // 並び替え
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        }

        // 並び替え結果の出力
        for (int answer: ans) {
            System.out.println(answer);
        }
    } main {
        Scanner sc = new Scanner(System.in).useDelimiter("\\D");

        int w = sc.nextInt();
        int[] ans = new int[w];
        for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        }

        // 並び替え
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        }

        // 並び替え結果の出力
        for (int answer: ans) {
            System.out.println(answer);
        }
    } Scanner sc = new Scanner(System.in).useDelimiter("\\D"); sc new Scanner(System.in).useDelimiter("\\D") new Scanner(System.in).useDelimiter new Scanner(System.in) "\\D" int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int[] ans = new int[w]; ans new int[w] w for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            ans[i] = i + 1;
        } {
            ans[i] = i + 1;
        } ans[i] = i + 1 ans[i] ans i i + 1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        } {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int tmp = ans[a - 1]; tmp ans[a - 1] ans a - 1 a 1 ans[a - 1] = ans[b - 1] ans[a - 1] ans a - 1 a 1 ans[b - 1] ans b - 1 b 1 ans[b - 1] = tmp ans[b - 1] ans b - 1 b 1 tmp for (int answer: ans) {
            System.out.println(answer);
        } int answer ans {
            System.out.println(answer);
        } {
            System.out.println(answer);
        } System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in).useDelimiter("\\D");

        int w = sc.nextInt();
        int[] ans = new int[w];
        for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        }

        // 並び替え
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        }

        // 並び替え結果の出力
        for (int answer: ans) {
            System.out.println(answer);
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in).useDelimiter("\\D");

        int w = sc.nextInt();
        int[] ans = new int[w];
        for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        }

        // 並び替え
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        }

        // 並び替え結果の出力
        for (int answer: ans) {
            System.out.println(answer);
        }
    }
} Main
import java.lang.System;
import java.lang.Exception;
import java.util.Scanner;

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

        int w = sc.nextInt();
        int[] ans = new int[w];
        for (int i = 0; i < w; i++) {
            ans[i] = i + 1;
        }

        // 並び替え
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int tmp = ans[a - 1];
            ans[a - 1] = ans[b - 1];
            ans[b - 1] = tmp;
        }

        // 並び替え結果の出力
        for (int answer: ans) {
            System.out.println(answer);
        }
    }
}