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

class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt(), n = scan.nextInt();
        int[] a = new int[n], b = new int[n];
        int[] ans = new int[w];

        scan.useDelimiter(",|\n");

        for (int j = 0; j < n; j++)
        {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        }

        for (int i = 1; i <= w; i++)
        {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(ans[i]);
        }
    }
} import java.util.*; util.* java import java.io.*; io.* java class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt(), n = scan.nextInt();
        int[] a = new int[n], b = new int[n];
        int[] ans = new int[w];

        scan.useDelimiter(",|\n");

        for (int j = 0; j < n; j++)
        {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        }

        for (int i = 1; i <= w; i++)
        {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(ans[i]);
        }
    }
} Main public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt(), n = scan.nextInt();
        int[] a = new int[n], b = new int[n];
        int[] ans = new int[w];

        scan.useDelimiter(",|\n");

        for (int j = 0; j < n; j++)
        {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        }

        for (int i = 1; i <= w; i++)
        {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(ans[i]);
        }
    } main {
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt(), n = scan.nextInt();
        int[] a = new int[n], b = new int[n];
        int[] ans = new int[w];

        scan.useDelimiter(",|\n");

        for (int j = 0; j < n; j++)
        {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        }

        for (int i = 1; i <= w; i++)
        {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(ans[i]);
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w = scan.nextInt() w scan.nextInt() scan.nextInt scan n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] a = new int[n] a new int[n] n b = new int[n]; b new int[n] n int[] ans = new int[w]; ans new int[w] w scan.useDelimiter(",|\n") scan.useDelimiter scan ",|\n" for (int j = 0; j < n; j++)
        {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        } {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        } a[j] = scan.nextInt() a[j] a j scan.nextInt() scan.nextInt scan b[j] = scan.nextInt() b[j] b j scan.nextInt() scan.nextInt scan for (int i = 1; i <= w; i++)
        {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        } int i = 1; int i = 1; i 1 i <= w i w i++ i++ i {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        } {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        } int now = i; now i for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            } {
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            } if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                } a[j] == now a[j] a j now {
                    now = b[j];
                } now = b[j] now b[j] b j if (b[j] == now)
                {
                    now = a[j];
                } b[j] == now b[j] b j now {
                    now = a[j];
                } now = a[j] now a[j] a j ans[now - 1] = i ans[now - 1] ans now - 1 now 1 i for (int i = 0; i < w; i++) {
            System.out.println(ans[i]);
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            System.out.println(ans[i]);
        } {
            System.out.println(ans[i]);
        } System.out.println(ans[i]) System.out.println System.out System System.out ans[i] ans i String[] args args
import java.util.*;
import java.io.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int w = scan.nextInt(), n = scan.nextInt();
        int[] a = new int[n], b = new int[n];
        int[] ans = new int[w];

        scan.useDelimiter(",|\n");

        for (int j = 0; j < n; j++)
        {
            a[j] = scan.nextInt();
            b[j] = scan.nextInt();
        }

        for (int i = 1; i <= w; i++)
        {
            int now = i;

            for (int j = 0; j < n; j++){
                if (a[j] == now)
                {
                    now = b[j];
                }
                else if (b[j] == now)
                {
                    now = a[j];
                }
            }
            ans[now - 1] = i;
        }

        for (int i = 0; i < w; i++) {
            System.out.println(ans[i]);
        }
    }
}