import static java.lang.System.out;
import static java.lang.Integer.parseInt;
import java.io.File;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().lots();
    }

    public void lots() {
        try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        }
    }

    private void draw(Scanner scan) {
        int[] lots = getLots(parseInt(scan.nextLine()));
        int crossCount = parseInt(scan.nextLine());
        for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        }
        for (int lot : lots) {
            out.println(lot);
        }
    }

    private int[] getLots(int count) {
        int[] lots = new int[count];
        for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        }
        return lots;
    }

    private void changeLot(String[] changeNumbers, int[] lots) {
        int beforeIndex = parseInt(changeNumbers[0]) - 1;
        int afterIndex = parseInt(changeNumbers[1]) - 1;
        int tmp = lots[beforeIndex];
        lots[beforeIndex] = lots[afterIndex];
        lots[afterIndex] = tmp;
    }
} import static java.lang.System.out; import static java.lang.System.out; import static java.lang.System.out; import static java.lang.Integer.parseInt; import static java.lang.Integer.parseInt; import static java.lang.Integer.parseInt; import java.io.File; File java.io import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        new Main().lots();
    }

    public void lots() {
        try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        }
    }

    private void draw(Scanner scan) {
        int[] lots = getLots(parseInt(scan.nextLine()));
        int crossCount = parseInt(scan.nextLine());
        for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        }
        for (int lot : lots) {
            out.println(lot);
        }
    }

    private int[] getLots(int count) {
        int[] lots = new int[count];
        for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        }
        return lots;
    }

    private void changeLot(String[] changeNumbers, int[] lots) {
        int beforeIndex = parseInt(changeNumbers[0]) - 1;
        int afterIndex = parseInt(changeNumbers[1]) - 1;
        int tmp = lots[beforeIndex];
        lots[beforeIndex] = lots[afterIndex];
        lots[afterIndex] = tmp;
    }
} Main public static void main(String[] args) {
        new Main().lots();
    } main {
        new Main().lots();
    } new Main().lots() new Main().lots new Main() String[] args args public void lots() {
        try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        }
    } lots {
        try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        }
    } try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        } catch (Exception e) {
            System.exit(0);
        } Exception e {
            System.exit(0);
        } System.exit(0) System.exit System 0 {
            draw(scan);
        } Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) draw(scan) draw scan private void draw(Scanner scan) {
        int[] lots = getLots(parseInt(scan.nextLine()));
        int crossCount = parseInt(scan.nextLine());
        for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        }
        for (int lot : lots) {
            out.println(lot);
        }
    } draw {
        int[] lots = getLots(parseInt(scan.nextLine()));
        int crossCount = parseInt(scan.nextLine());
        for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        }
        for (int lot : lots) {
            out.println(lot);
        }
    } int[] lots = getLots(parseInt(scan.nextLine())); lots getLots(parseInt(scan.nextLine())) getLots parseInt(scan.nextLine()) parseInt scan.nextLine() scan.nextLine scan int crossCount = parseInt(scan.nextLine()); crossCount parseInt(scan.nextLine()) parseInt scan.nextLine() scan.nextLine scan for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        } int chageCount = 0; int chageCount = 0; chageCount 0 chageCount < crossCount chageCount crossCount chageCount++ chageCount++ chageCount {
            changeLot(scan.nextLine().split(","), lots);
        } {
            changeLot(scan.nextLine().split(","), lots);
        } changeLot(scan.nextLine().split(","), lots) changeLot scan.nextLine().split(",") scan.nextLine().split scan.nextLine() scan.nextLine scan "," lots for (int lot : lots) {
            out.println(lot);
        } int lot lots {
            out.println(lot);
        } {
            out.println(lot);
        } out.println(lot) out.println out lot Scanner scan scan private int[] getLots(int count) {
        int[] lots = new int[count];
        for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        }
        return lots;
    } getLots {
        int[] lots = new int[count];
        for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        }
        return lots;
    } int[] lots = new int[count]; lots new int[count] count for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        } int lotIndex = 0; int lotIndex = 0; lotIndex 0 lotIndex < count lotIndex count lotIndex++ lotIndex++ lotIndex {
            lots[lotIndex] = lotIndex + 1;
        } {
            lots[lotIndex] = lotIndex + 1;
        } lots[lotIndex] = lotIndex + 1 lots[lotIndex] lots lotIndex lotIndex + 1 lotIndex 1 return lots; lots int count count private void changeLot(String[] changeNumbers, int[] lots) {
        int beforeIndex = parseInt(changeNumbers[0]) - 1;
        int afterIndex = parseInt(changeNumbers[1]) - 1;
        int tmp = lots[beforeIndex];
        lots[beforeIndex] = lots[afterIndex];
        lots[afterIndex] = tmp;
    } changeLot {
        int beforeIndex = parseInt(changeNumbers[0]) - 1;
        int afterIndex = parseInt(changeNumbers[1]) - 1;
        int tmp = lots[beforeIndex];
        lots[beforeIndex] = lots[afterIndex];
        lots[afterIndex] = tmp;
    } int beforeIndex = parseInt(changeNumbers[0]) - 1; beforeIndex parseInt(changeNumbers[0]) - 1 parseInt(changeNumbers[0]) parseInt changeNumbers[0] changeNumbers 0 1 int afterIndex = parseInt(changeNumbers[1]) - 1; afterIndex parseInt(changeNumbers[1]) - 1 parseInt(changeNumbers[1]) parseInt changeNumbers[1] changeNumbers 1 1 int tmp = lots[beforeIndex]; tmp lots[beforeIndex] lots beforeIndex lots[beforeIndex] = lots[afterIndex] lots[beforeIndex] lots beforeIndex lots[afterIndex] lots afterIndex lots[afterIndex] = tmp lots[afterIndex] lots afterIndex tmp String[] changeNumbers changeNumbers int[] lots lots public class Main {

    public static void main(String[] args) {
        new Main().lots();
    }

    public void lots() {
        try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        }
    }

    private void draw(Scanner scan) {
        int[] lots = getLots(parseInt(scan.nextLine()));
        int crossCount = parseInt(scan.nextLine());
        for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        }
        for (int lot : lots) {
            out.println(lot);
        }
    }

    private int[] getLots(int count) {
        int[] lots = new int[count];
        for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        }
        return lots;
    }

    private void changeLot(String[] changeNumbers, int[] lots) {
        int beforeIndex = parseInt(changeNumbers[0]) - 1;
        int afterIndex = parseInt(changeNumbers[1]) - 1;
        int tmp = lots[beforeIndex];
        lots[beforeIndex] = lots[afterIndex];
        lots[afterIndex] = tmp;
    }
} public class Main {

    public static void main(String[] args) {
        new Main().lots();
    }

    public void lots() {
        try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        }
    }

    private void draw(Scanner scan) {
        int[] lots = getLots(parseInt(scan.nextLine()));
        int crossCount = parseInt(scan.nextLine());
        for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        }
        for (int lot : lots) {
            out.println(lot);
        }
    }

    private int[] getLots(int count) {
        int[] lots = new int[count];
        for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        }
        return lots;
    }

    private void changeLot(String[] changeNumbers, int[] lots) {
        int beforeIndex = parseInt(changeNumbers[0]) - 1;
        int afterIndex = parseInt(changeNumbers[1]) - 1;
        int tmp = lots[beforeIndex];
        lots[beforeIndex] = lots[afterIndex];
        lots[afterIndex] = tmp;
    }
} Main
import static java.lang.System.out;
import static java.lang.Integer.parseInt;
import java.io.File;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().lots();
    }

    public void lots() {
        try (Scanner scan = new Scanner(System.in)) {
            draw(scan);
        } catch (Exception e) {
            System.exit(0);
        }
    }

    private void draw(Scanner scan) {
        int[] lots = getLots(parseInt(scan.nextLine()));
        int crossCount = parseInt(scan.nextLine());
        for (int chageCount = 0; chageCount < crossCount; chageCount++) {
            changeLot(scan.nextLine().split(","), lots);
        }
        for (int lot : lots) {
            out.println(lot);
        }
    }

    private int[] getLots(int count) {
        int[] lots = new int[count];
        for (int lotIndex = 0; lotIndex < count; lotIndex++) {
            lots[lotIndex] = lotIndex + 1;
        }
        return lots;
    }

    private void changeLot(String[] changeNumbers, int[] lots) {
        int beforeIndex = parseInt(changeNumbers[0]) - 1;
        int afterIndex = parseInt(changeNumbers[1]) - 1;
        int tmp = lots[beforeIndex];
        lots[beforeIndex] = lots[afterIndex];
        lots[afterIndex] = tmp;
    }
}