import java.util.Scanner;

public class Main {
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x, y, c;
        String str;

        str = sc.nextLine();
        int w = Integer.parseInt(str);
        int[] a = new int[w];
        for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        }

        str = sc.nextLine();
        int n = Integer.parseInt(str);

        for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        }
        sc.close();

        for (int i = 0; i < w; i++) System.out.println(a[i]);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x, y, c;
        String str;

        str = sc.nextLine();
        int w = Integer.parseInt(str);
        int[] a = new int[w];
        for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        }

        str = sc.nextLine();
        int n = Integer.parseInt(str);

        for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        }
        sc.close();

        for (int i = 0; i < w; i++) System.out.println(a[i]);
    }
} Main public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x, y, c;
        String str;

        str = sc.nextLine();
        int w = Integer.parseInt(str);
        int[] a = new int[w];
        for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        }

        str = sc.nextLine();
        int n = Integer.parseInt(str);

        for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        }
        sc.close();

        for (int i = 0; i < w; i++) System.out.println(a[i]);
    } main {
        Scanner sc = new Scanner(System.in);
        int x, y, c;
        String str;

        str = sc.nextLine();
        int w = Integer.parseInt(str);
        int[] a = new int[w];
        for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        }

        str = sc.nextLine();
        int n = Integer.parseInt(str);

        for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        }
        sc.close();

        for (int i = 0; i < w; i++) System.out.println(a[i]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x x y y c; c String str; str str = sc.nextLine() str sc.nextLine() sc.nextLine sc int w = Integer.parseInt(str); w Integer.parseInt(str) Integer.parseInt Integer str int[] a = new int[w]; a new int[w] w for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            a[i] = i + 1;
        } {
            a[i] = i + 1;
        } a[i] = i + 1 a[i] a i i + 1 i 1 str = sc.nextLine() str sc.nextLine() sc.nextLine sc int n = Integer.parseInt(str); n Integer.parseInt(str) Integer.parseInt Integer str for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        } {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        } str = sc.nextLine() str sc.nextLine() sc.nextLine sc String[] X = str.split(",", -1); X str.split(",", -1) str.split str "," -1 1 x = Integer.parseInt(X[0]) x Integer.parseInt(X[0]) Integer.parseInt Integer X[0] X 0 y = Integer.parseInt(X[1]) y Integer.parseInt(X[1]) Integer.parseInt Integer X[1] X 1 c = a[x-1] c a[x-1] a x-1 x 1 a[x-1] = a[y-1] a[x-1] a x-1 x 1 a[y-1] a y-1 y 1 a[y-1] = c a[y-1] a y-1 y 1 c sc.close() sc.close sc for (int i = 0; i < w; i++) System.out.println(a[i]); int i = 0; int i = 0; i 0 i < w i w i++ i++ i System.out.println(a[i]); System.out.println(a[i]) System.out.println System.out System System.out a[i] a i String[] args args public class Main {
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x, y, c;
        String str;

        str = sc.nextLine();
        int w = Integer.parseInt(str);
        int[] a = new int[w];
        for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        }

        str = sc.nextLine();
        int n = Integer.parseInt(str);

        for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        }
        sc.close();

        for (int i = 0; i < w; i++) System.out.println(a[i]);
    }
} public class Main {
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x, y, c;
        String str;

        str = sc.nextLine();
        int w = Integer.parseInt(str);
        int[] a = new int[w];
        for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        }

        str = sc.nextLine();
        int n = Integer.parseInt(str);

        for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        }
        sc.close();

        for (int i = 0; i < w; i++) System.out.println(a[i]);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x, y, c;
        String str;

        str = sc.nextLine();
        int w = Integer.parseInt(str);
        int[] a = new int[w];
        for (int i = 0; i < w; i++)
        {
            a[i] = i + 1;
        }

        str = sc.nextLine();
        int n = Integer.parseInt(str);

        for (int i = 0; i < n; i++)
        {
            str = sc.nextLine();
            String[] X = str.split(",", -1);
            x = Integer.parseInt(X[0]);
            y = Integer.parseInt(X[1]);
            c = a[x-1];
            a[x-1] = a[y-1];
            a[y-1] = c;
        }
        sc.close();

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