import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

class Main {

    public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    }

    static void doit(String[] args, InputStream in, PrintStream out) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int w = Integer.parseInt(reader.readLine());
        int n = Integer.parseInt(reader.readLine());
        int[] numbers = new int[w];
        for (int i = 0; i < w; i++) {
            numbers[i] = i + 1;
        }
        for (int i = 0; i < n; i++) {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        }
        for (int i = 0; i < w; i++) {
            out.println(numbers[i]);
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintStream; PrintStream java.io class Main {

    public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    }

    static void doit(String[] args, InputStream in, PrintStream out) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int w = Integer.parseInt(reader.readLine());
        int n = Integer.parseInt(reader.readLine());
        int[] numbers = new int[w];
        for (int i = 0; i < w; i++) {
            numbers[i] = i + 1;
        }
        for (int i = 0; i < n; i++) {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        }
        for (int i = 0; i < w; i++) {
            out.println(numbers[i]);
        }
    }
} Main public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    } main {
        doit(args, System.in, System.out);
    } doit(args, System.in, System.out) doit args System.in System System.in System.out System System.out String[] args args static void doit(String[] args, InputStream in, PrintStream out) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int w = Integer.parseInt(reader.readLine());
        int n = Integer.parseInt(reader.readLine());
        int[] numbers = new int[w];
        for (int i = 0; i < w; i++) {
            numbers[i] = i + 1;
        }
        for (int i = 0; i < n; i++) {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        }
        for (int i = 0; i < w; i++) {
            out.println(numbers[i]);
        }
    } doit {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int w = Integer.parseInt(reader.readLine());
        int n = Integer.parseInt(reader.readLine());
        int[] numbers = new int[w];
        for (int i = 0; i < w; i++) {
            numbers[i] = i + 1;
        }
        for (int i = 0; i < n; i++) {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        }
        for (int i = 0; i < w; i++) {
            out.println(numbers[i]);
        }
    } BufferedReader reader = new BufferedReader(new InputStreamReader(in)); reader new BufferedReader(new InputStreamReader(in)) int w = Integer.parseInt(reader.readLine()); w Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] numbers = new int[w]; numbers new int[w] w for (int i = 0; i < w; i++) {
            numbers[i] = i + 1;
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            numbers[i] = i + 1;
        } {
            numbers[i] = i + 1;
        } numbers[i] = i + 1 numbers[i] numbers i i + 1 i 1 for (int i = 0; i < n; i++) {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        } {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        } String[] values = reader.readLine().split(","); values reader.readLine().split(",") reader.readLine().split reader.readLine() reader.readLine reader "," int a = Integer.parseInt(values[0]); a Integer.parseInt(values[0]) Integer.parseInt Integer values[0] values 0 int b = Integer.parseInt(values[1]); b Integer.parseInt(values[1]) Integer.parseInt Integer values[1] values 1 int tmp = numbers[a - 1]; tmp numbers[a - 1] numbers a - 1 a 1 numbers[a - 1] = numbers[b - 1] numbers[a - 1] numbers a - 1 a 1 numbers[b - 1] numbers b - 1 b 1 numbers[b - 1] = tmp numbers[b - 1] numbers b - 1 b 1 tmp for (int i = 0; i < w; i++) {
            out.println(numbers[i]);
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            out.println(numbers[i]);
        } {
            out.println(numbers[i]);
        } out.println(numbers[i]) out.println out numbers[i] numbers i String[] args args InputStream in in PrintStream out out
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

class Main {

    public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    }

    static void doit(String[] args, InputStream in, PrintStream out) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int w = Integer.parseInt(reader.readLine());
        int n = Integer.parseInt(reader.readLine());
        int[] numbers = new int[w];
        for (int i = 0; i < w; i++) {
            numbers[i] = i + 1;
        }
        for (int i = 0; i < n; i++) {
            String[] values = reader.readLine().split(",");
            int a = Integer.parseInt(values[0]);
            int b = Integer.parseInt(values[1]);
            int tmp = numbers[a - 1];
            numbers[a - 1] = numbers[b - 1];
            numbers[b - 1] = tmp;
        }
        for (int i = 0; i < w; i++) {
            out.println(numbers[i]);
        }
    }
}