import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStreamReader inputReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputReader);

        final int column = Integer.parseInt(reader.readLine());
        NumberList list = new NumberList(column);

        final int row = Integer.parseInt(reader.readLine());
        for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        }

        StringBuilder builder = new StringBuilder();
        List<Integer> resultList = list.getList();
        for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        }
        System.out.print(builder);
    }

}

class NumberList {

    private List<Integer> list;

    public NumberList(int size) {
        list = new ArrayList<>();
        for (int i = 1; i <= size; i++) {
            list.add(i);
        }
    }

    public void swap(int index1, int index2) {
        int tmp = list.get(index1);
        list.set(index1, list.get(index2));
        list.set(index2, tmp);
    }

    public List<Integer> getList() {
        return list;
    }

} import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io import java.util.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util public class Main {

    public static void main(String[] args) throws IOException {
        InputStreamReader inputReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputReader);

        final int column = Integer.parseInt(reader.readLine());
        NumberList list = new NumberList(column);

        final int row = Integer.parseInt(reader.readLine());
        for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        }

        StringBuilder builder = new StringBuilder();
        List<Integer> resultList = list.getList();
        for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        }
        System.out.print(builder);
    }

} Main public static void main(String[] args) throws IOException {
        InputStreamReader inputReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputReader);

        final int column = Integer.parseInt(reader.readLine());
        NumberList list = new NumberList(column);

        final int row = Integer.parseInt(reader.readLine());
        for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        }

        StringBuilder builder = new StringBuilder();
        List<Integer> resultList = list.getList();
        for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        }
        System.out.print(builder);
    } main {
        InputStreamReader inputReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputReader);

        final int column = Integer.parseInt(reader.readLine());
        NumberList list = new NumberList(column);

        final int row = Integer.parseInt(reader.readLine());
        for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        }

        StringBuilder builder = new StringBuilder();
        List<Integer> resultList = list.getList();
        for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        }
        System.out.print(builder);
    } InputStreamReader inputReader = new InputStreamReader(System.in); inputReader new InputStreamReader(System.in) BufferedReader reader = new BufferedReader(inputReader); reader new BufferedReader(inputReader) final int column = Integer.parseInt(reader.readLine()); column Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader NumberList list = new NumberList(column); list new NumberList(column) final int row = Integer.parseInt(reader.readLine()); row Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        } int i = 0; int i = 0; i 0 i < row i row i++ i++ i {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        } {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        } final String line = reader.readLine(); line reader.readLine() reader.readLine reader final StringTokenizer tokenizer = new StringTokenizer(line, ","); tokenizer new StringTokenizer(line, ",") final int a = Integer.parseInt(tokenizer.nextToken()); a Integer.parseInt(tokenizer.nextToken()) Integer.parseInt Integer tokenizer.nextToken() tokenizer.nextToken tokenizer final int b = Integer.parseInt(tokenizer.nextToken()); b Integer.parseInt(tokenizer.nextToken()) Integer.parseInt Integer tokenizer.nextToken() tokenizer.nextToken tokenizer list.swap(a - 1, b - 1) list.swap list a - 1 a 1 b - 1 b 1 StringBuilder builder = new StringBuilder(); builder new StringBuilder() List<Integer> resultList = list.getList(); resultList list.getList() list.getList list for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        } int value resultList {
            builder.append(String.format("%d\n", value));
        } {
            builder.append(String.format("%d\n", value));
        } builder.append(String.format("%d\n", value)) builder.append builder String.format("%d\n", value) String.format String "%d\n" value System.out.print(builder) System.out.print System.out System System.out builder String[] args args class NumberList {

    private List<Integer> list;

    public NumberList(int size) {
        list = new ArrayList<>();
        for (int i = 1; i <= size; i++) {
            list.add(i);
        }
    }

    public void swap(int index1, int index2) {
        int tmp = list.get(index1);
        list.set(index1, list.get(index2));
        list.set(index2, tmp);
    }

    public List<Integer> getList() {
        return list;
    }

} NumberList private List<Integer> list; list public NumberList(int size) {
        list = new ArrayList<>();
        for (int i = 1; i <= size; i++) {
            list.add(i);
        }
    } NumberList {
        list = new ArrayList<>();
        for (int i = 1; i <= size; i++) {
            list.add(i);
        }
    } list = new ArrayList<>() list new ArrayList<>() for (int i = 1; i <= size; i++) {
            list.add(i);
        } int i = 1; int i = 1; i 1 i <= size i size i++ i++ i {
            list.add(i);
        } {
            list.add(i);
        } list.add(i) list.add list i int size size public void swap(int index1, int index2) {
        int tmp = list.get(index1);
        list.set(index1, list.get(index2));
        list.set(index2, tmp);
    } swap {
        int tmp = list.get(index1);
        list.set(index1, list.get(index2));
        list.set(index2, tmp);
    } int tmp = list.get(index1); tmp list.get(index1) list.get list index1 list.set(index1, list.get(index2)) list.set list index1 list.get(index2) list.get list index2 list.set(index2, tmp) list.set list index2 tmp int index1 index1 int index2 index2 public List<Integer> getList() {
        return list;
    } getList {
        return list;
    } return list; list public class Main {

    public static void main(String[] args) throws IOException {
        InputStreamReader inputReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputReader);

        final int column = Integer.parseInt(reader.readLine());
        NumberList list = new NumberList(column);

        final int row = Integer.parseInt(reader.readLine());
        for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        }

        StringBuilder builder = new StringBuilder();
        List<Integer> resultList = list.getList();
        for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        }
        System.out.print(builder);
    }

} public class Main {

    public static void main(String[] args) throws IOException {
        InputStreamReader inputReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputReader);

        final int column = Integer.parseInt(reader.readLine());
        NumberList list = new NumberList(column);

        final int row = Integer.parseInt(reader.readLine());
        for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        }

        StringBuilder builder = new StringBuilder();
        List<Integer> resultList = list.getList();
        for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        }
        System.out.print(builder);
    }

} Main
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStreamReader inputReader = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(inputReader);

        final int column = Integer.parseInt(reader.readLine());
        NumberList list = new NumberList(column);

        final int row = Integer.parseInt(reader.readLine());
        for (int i = 0; i < row; i++) {
            final String line = reader.readLine();
            final StringTokenizer tokenizer = new StringTokenizer(line, ",");

            final int a = Integer.parseInt(tokenizer.nextToken());
            final int b = Integer.parseInt(tokenizer.nextToken());

            list.swap(a - 1, b - 1);
        }

        StringBuilder builder = new StringBuilder();
        List<Integer> resultList = list.getList();
        for (int value : resultList) {
            builder.append(String.format("%d\n", value));
        }
        System.out.print(builder);
    }

}

class NumberList {

    private List<Integer> list;

    public NumberList(int size) {
        list = new ArrayList<>();
        for (int i = 1; i <= size; i++) {
            list.add(i);
        }
    }

    public void swap(int index1, int index2) {
        int tmp = list.get(index1);
        list.set(index1, list.get(index2));
        list.set(index2, tmp);
    }

    public List<Integer> getList() {
        return list;
    }

}