import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.text.DecimalFormat;

class Main {
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int w = sc.nextInt();
        int[] nums = new int[w];
        for (int i = 0; i < w; i++) {
            nums[i] = i + 1;
        }

        int n = sc.nextInt();
        sc.nextLine();

        int a, b, temp;
        String[] pair;
        for (int i = 0; i < n; i++) {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        }

        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < w; i++) {
            sb.append(nums[i]);
            sb.append('\n');
        }
        System.out.print(sb);
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util import java.text.DecimalFormat; DecimalFormat java.text class Main {
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int w = sc.nextInt();
        int[] nums = new int[w];
        for (int i = 0; i < w; i++) {
            nums[i] = i + 1;
        }

        int n = sc.nextInt();
        sc.nextLine();

        int a, b, temp;
        String[] pair;
        for (int i = 0; i < n; i++) {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        }

        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < w; i++) {
            sb.append(nums[i]);
            sb.append('\n');
        }
        System.out.print(sb);
    }
} Main public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int w = sc.nextInt();
        int[] nums = new int[w];
        for (int i = 0; i < w; i++) {
            nums[i] = i + 1;
        }

        int n = sc.nextInt();
        sc.nextLine();

        int a, b, temp;
        String[] pair;
        for (int i = 0; i < n; i++) {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        }

        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < w; i++) {
            sb.append(nums[i]);
            sb.append('\n');
        }
        System.out.print(sb);
    } main {
        Scanner sc = new Scanner(System.in);

        int w = sc.nextInt();
        int[] nums = new int[w];
        for (int i = 0; i < w; i++) {
            nums[i] = i + 1;
        }

        int n = sc.nextInt();
        sc.nextLine();

        int a, b, temp;
        String[] pair;
        for (int i = 0; i < n; i++) {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        }

        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < w; i++) {
            sb.append(nums[i]);
            sb.append('\n');
        }
        System.out.print(sb);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int[] nums = new int[w]; nums new int[w] w for (int i = 0; i < w; i++) {
            nums[i] = i + 1;
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            nums[i] = i + 1;
        } {
            nums[i] = i + 1;
        } nums[i] = i + 1 nums[i] nums i i + 1 i 1 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc int a a b b temp; temp String[] pair; pair for (int i = 0; i < n; i++) {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        } {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        } pair = sc.nextLine().split(",") pair sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," a = Integer.parseInt(pair[0]) - 1 a Integer.parseInt(pair[0]) - 1 Integer.parseInt(pair[0]) Integer.parseInt Integer pair[0] pair 0 1 b = Integer.parseInt(pair[1]) - 1 b Integer.parseInt(pair[1]) - 1 Integer.parseInt(pair[1]) Integer.parseInt Integer pair[1] pair 1 1 temp = nums[a] temp nums[a] nums a nums[a] = nums[b] nums[a] nums a nums[b] nums b nums[b] = temp nums[b] nums b temp StringBuilder sb = new StringBuilder(""); sb new StringBuilder("") for (int i = 0; i < w; i++) {
            sb.append(nums[i]);
            sb.append('\n');
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            sb.append(nums[i]);
            sb.append('\n');
        } {
            sb.append(nums[i]);
            sb.append('\n');
        } sb.append(nums[i]) sb.append sb nums[i] nums i sb.append('\n') sb.append sb '\n' System.out.print(sb) System.out.print System.out System System.out sb String[] args args
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.text.DecimalFormat;

class Main {
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int w = sc.nextInt();
        int[] nums = new int[w];
        for (int i = 0; i < w; i++) {
            nums[i] = i + 1;
        }

        int n = sc.nextInt();
        sc.nextLine();

        int a, b, temp;
        String[] pair;
        for (int i = 0; i < n; i++) {
            pair = sc.nextLine().split(",");
            a = Integer.parseInt(pair[0]) - 1;
            b = Integer.parseInt(pair[1]) - 1;

            temp = nums[a];
            nums[a] = nums[b];
            nums[b] = temp;
        }

        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < w; i++) {
            sb.append(nums[i]);
            sb.append('\n');
        }
        System.out.print(sb);
    }
}