
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int[] lines = new int[Integer.parseInt(in.readLine())];
        for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        }

        int count = 1;
        count = Integer.parseInt(in.readLine());

        while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        }
        for (int i : lines) {
            System.out.println(i);
        }
        //*/
    }

    private static void swap(int[] lines, int a, int b) {
        int temp = lines[a];
        lines[a] = lines[b];
        lines[b] = temp;
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {

    public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int[] lines = new int[Integer.parseInt(in.readLine())];
        for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        }

        int count = 1;
        count = Integer.parseInt(in.readLine());

        while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        }
        for (int i : lines) {
            System.out.println(i);
        }
        //*/
    }

    private static void swap(int[] lines, int a, int b) {
        int temp = lines[a];
        lines[a] = lines[b];
        lines[b] = temp;
    }
} Main public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int[] lines = new int[Integer.parseInt(in.readLine())];
        for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        }

        int count = 1;
        count = Integer.parseInt(in.readLine());

        while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        }
        for (int i : lines) {
            System.out.println(i);
        }
        //*/
    } main {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int[] lines = new int[Integer.parseInt(in.readLine())];
        for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        }

        int count = 1;
        count = Integer.parseInt(in.readLine());

        while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        }
        for (int i : lines) {
            System.out.println(i);
        }
        //*/
    } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int[] lines = new int[Integer.parseInt(in.readLine())]; lines new int[Integer.parseInt(in.readLine())] Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        } int i = 0; int i = 0; i 0 i < lines.length i lines.length lines lines.length i++ i++ i {
            lines[i] = i + 1;
        } {
            lines[i] = i + 1;
        } lines[i] = i + 1 lines[i] lines i i + 1 i 1 int count = 1; count 1 count = Integer.parseInt(in.readLine()) count Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        } count-- > 0 count-- count 0 {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        } String[] s = in.readLine().split(","); s in.readLine().split(",") in.readLine().split in.readLine() in.readLine in "," swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1) swap lines Integer.parseInt(s[0]) - 1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 Integer.parseInt(s[1]) - 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 for (int i : lines) {
            System.out.println(i);
        } int i lines {
            System.out.println(i);
        } {
            System.out.println(i);
        } System.out.println(i) System.out.println System.out System System.out i String[] argv argv private static void swap(int[] lines, int a, int b) {
        int temp = lines[a];
        lines[a] = lines[b];
        lines[b] = temp;
    } swap {
        int temp = lines[a];
        lines[a] = lines[b];
        lines[b] = temp;
    } int temp = lines[a]; temp lines[a] lines a lines[a] = lines[b] lines[a] lines a lines[b] lines b lines[b] = temp lines[b] lines b temp int[] lines lines int a a int b b public class Main {

    public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int[] lines = new int[Integer.parseInt(in.readLine())];
        for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        }

        int count = 1;
        count = Integer.parseInt(in.readLine());

        while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        }
        for (int i : lines) {
            System.out.println(i);
        }
        //*/
    }

    private static void swap(int[] lines, int a, int b) {
        int temp = lines[a];
        lines[a] = lines[b];
        lines[b] = temp;
    }
} public class Main {

    public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int[] lines = new int[Integer.parseInt(in.readLine())];
        for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        }

        int count = 1;
        count = Integer.parseInt(in.readLine());

        while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        }
        for (int i : lines) {
            System.out.println(i);
        }
        //*/
    }

    private static void swap(int[] lines, int a, int b) {
        int temp = lines[a];
        lines[a] = lines[b];
        lines[b] = temp;
    }
} Main

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] argv) throws IOException {
        //*
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        int[] lines = new int[Integer.parseInt(in.readLine())];
        for (int i = 0; i < lines.length; i++) {
            lines[i] = i + 1;
        }

        int count = 1;
        count = Integer.parseInt(in.readLine());

        while (count-- > 0) {
            String[] s = in.readLine().split(",");
            swap(lines, Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1);
        }
        for (int i : lines) {
            System.out.println(i);
        }
        //*/
    }

    private static void swap(int[] lines, int a, int b) {
        int temp = lines[a];
        lines[a] = lines[b];
        lines[b] = temp;
    }
}