import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        in.useDelimiter("\\D");
        int w = in.nextInt();
        int n = in.nextInt();
        int[] amida = new int[w + 1];
        for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        }
        while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        }
        for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        in.useDelimiter("\\D");
        int w = in.nextInt();
        int n = in.nextInt();
        int[] amida = new int[w + 1];
        for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        }
        while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        }
        for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        }
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    } try (Scanner in = new Scanner(System.in)) {
            solve(in);
        } {
            solve(in);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) solve(in) solve in String[] args args private static void solve(Scanner in) {
        in.useDelimiter("\\D");
        int w = in.nextInt();
        int n = in.nextInt();
        int[] amida = new int[w + 1];
        for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        }
        while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        }
        for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        }
    } solve {
        in.useDelimiter("\\D");
        int w = in.nextInt();
        int n = in.nextInt();
        int[] amida = new int[w + 1];
        for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        }
        while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        }
        for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        }
    } in.useDelimiter("\\D") in.useDelimiter in "\\D" int w = in.nextInt(); w in.nextInt() in.nextInt in int n = in.nextInt(); n in.nextInt() in.nextInt in int[] amida = new int[w + 1]; amida new int[w + 1] w + 1 w 1 for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        } int i = 1; int i = 1; i 1 i < amida.length i amida.length amida amida.length i++ i++ i {
            amida[i] = i;
        } {
            amida[i] = i;
        } amida[i] = i amida[i] amida i i while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        } n --> 0 n -- n 0 {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        } int a = in.nextInt(); a in.nextInt() in.nextInt in int b = in.nextInt(); b in.nextInt() in.nextInt in int tmp = amida[a]; tmp amida[a] amida a amida[a] = amida[b] amida[a] amida a amida[b] amida b amida[b] = tmp amida[b] amida b tmp for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        } int i = 1; int i = 1; i 1 i < amida.length i amida.length amida amida.length i++ i++ i {
            System.out.println(amida[i]);
        } {
            System.out.println(amida[i]);
        } System.out.println(amida[i]) System.out.println System.out System System.out amida[i] amida i Scanner in in public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        in.useDelimiter("\\D");
        int w = in.nextInt();
        int n = in.nextInt();
        int[] amida = new int[w + 1];
        for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        }
        while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        }
        for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        }
    }
} public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        in.useDelimiter("\\D");
        int w = in.nextInt();
        int n = in.nextInt();
        int[] amida = new int[w + 1];
        for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        }
        while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        }
        for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        in.useDelimiter("\\D");
        int w = in.nextInt();
        int n = in.nextInt();
        int[] amida = new int[w + 1];
        for (int i = 1; i < amida.length; i++) {
            amida[i] = i;
        }
        while (n --> 0) {
            int a = in.nextInt();
            int b = in.nextInt();

            int tmp = amida[a];
            amida[a] = amida[b];
            amida[b] = tmp;
        }
        for (int i = 1; i < amida.length; i++) {
            System.out.println(amida[i]);
        }
    }
}