import java.util.*;

class Main {
    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

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

        int[] member = new int[w];
        for (int m = 0; m < w; m++) {
            member[m] = m;
        }

        for (int t = 0; t < n; t++) {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        }

        for (int m = 0; m < w; m++) {
            System.out.println(member[m] + 1);
        }
    }
} import java.util.*; util.* java class Main {
    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

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

        int[] member = new int[w];
        for (int m = 0; m < w; m++) {
            member[m] = m;
        }

        for (int t = 0; t < n; t++) {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        }

        for (int m = 0; m < w; m++) {
            System.out.println(member[m] + 1);
        }
    }
} Main public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

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

        int[] member = new int[w];
        for (int m = 0; m < w; m++) {
            member[m] = m;
        }

        for (int t = 0; t < n; t++) {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        }

        for (int m = 0; m < w; m++) {
            System.out.println(member[m] + 1);
        }
    } main {

        Scanner sc = new Scanner(System.in);

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

        int[] member = new int[w];
        for (int m = 0; m < w; m++) {
            member[m] = m;
        }

        for (int t = 0; t < n; t++) {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        }

        for (int m = 0; m < w; m++) {
            System.out.println(member[m] + 1);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] member = new int[w]; member new int[w] w for (int m = 0; m < w; m++) {
            member[m] = m;
        } int m = 0; int m = 0; m 0 m < w m w m++ m++ m {
            member[m] = m;
        } {
            member[m] = m;
        } member[m] = m member[m] member m m for (int t = 0; t < n; t++) {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        } int t = 0; int t = 0; t 0 t < n t n t++ t++ t {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        } {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        } String[] bar = sc.next().split(","); bar sc.next().split(",") sc.next().split sc.next() sc.next sc "," int a = Integer.parseInt(bar[0]) - 1; a Integer.parseInt(bar[0]) - 1 Integer.parseInt(bar[0]) Integer.parseInt Integer bar[0] bar 0 1 int b = Integer.parseInt(bar[1]) - 1; b Integer.parseInt(bar[1]) - 1 Integer.parseInt(bar[1]) Integer.parseInt Integer bar[1] bar 1 1 int tmp = member[b]; tmp member[b] member b member[b] = member[a] member[b] member b member[a] member a member[a] = tmp member[a] member a tmp for (int m = 0; m < w; m++) {
            System.out.println(member[m] + 1);
        } int m = 0; int m = 0; m 0 m < w m w m++ m++ m {
            System.out.println(member[m] + 1);
        } {
            System.out.println(member[m] + 1);
        } System.out.println(member[m] + 1) System.out.println System.out System System.out member[m] + 1 member[m] member m 1 String [] args args
import java.util.*;

class Main {
    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

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

        int[] member = new int[w];
        for (int m = 0; m < w; m++) {
            member[m] = m;
        }

        for (int t = 0; t < n; t++) {
            String[] bar = sc.next().split(",");
            int a = Integer.parseInt(bar[0]) - 1;
            int b = Integer.parseInt(bar[1]) - 1;

            int tmp = member[b];
            member[b] = member[a];
            member[a] = tmp;
        }

        for (int m = 0; m < w; m++) {
            System.out.println(member[m] + 1);
        }
    }
}