import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
        int num[],c,i,n,w;
        w = sc.nextInt();
        n = sc.nextInt();

        num = new int[30];

        for(i=0;i<w;i++) num[i] = i + 1;

        for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	}

        for(i=0;i<w;i++) System.out.printf("%d\n",num[i]);

    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
        int num[],c,i,n,w;
        w = sc.nextInt();
        n = sc.nextInt();

        num = new int[30];

        for(i=0;i<w;i++) num[i] = i + 1;

        for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	}

        for(i=0;i<w;i++) System.out.printf("%d\n",num[i]);

    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
        int num[],c,i,n,w;
        w = sc.nextInt();
        n = sc.nextInt();

        num = new int[30];

        for(i=0;i<w;i++) num[i] = i + 1;

        for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	}

        for(i=0;i<w;i++) System.out.printf("%d\n",num[i]);

    } main {
	Scanner sc = new Scanner(System.in);
        int num[],c,i,n,w;
        w = sc.nextInt();
        n = sc.nextInt();

        num = new int[30];

        for(i=0;i<w;i++) num[i] = i + 1;

        for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	}

        for(i=0;i<w;i++) System.out.printf("%d\n",num[i]);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num[] num c c i i n n w; w w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc num = new int[30] num new int[30] 30 for(i=0;i<w;i++) num[i] = i + 1; i=0; i=0 i 0 i<w i w i++ i++ i num[i] = i + 1; num[i] = i + 1 num[i] num i i + 1 i 1 for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	} i=0; i=0 i 0 i<n i n i++ i++ i {
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	} {
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	} String str = sc.next(); str sc.next() sc.next sc String[] ab = str.split(","); ab str.split(",") str.split str "," int a = Integer.parseInt(ab[0]) - 1; a Integer.parseInt(ab[0]) - 1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1]) - 1; b Integer.parseInt(ab[1]) - 1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 c = num[a] c num[a] num a num[a] = num[b] num[a] num a num[b] num b num[b] = c num[b] num b c for(i=0;i<w;i++) System.out.printf("%d\n",num[i]); i=0; i=0 i 0 i<w i w i++ i++ i System.out.printf("%d\n",num[i]); System.out.printf("%d\n",num[i]) System.out.printf System.out System System.out "%d\n" num[i] num i String[] args args public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
        int num[],c,i,n,w;
        w = sc.nextInt();
        n = sc.nextInt();

        num = new int[30];

        for(i=0;i<w;i++) num[i] = i + 1;

        for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	}

        for(i=0;i<w;i++) System.out.printf("%d\n",num[i]);

    }
} public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
        int num[],c,i,n,w;
        w = sc.nextInt();
        n = sc.nextInt();

        num = new int[30];

        for(i=0;i<w;i++) num[i] = i + 1;

        for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	}

        for(i=0;i<w;i++) System.out.printf("%d\n",num[i]);

    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
        int num[],c,i,n,w;
        w = sc.nextInt();
        n = sc.nextInt();

        num = new int[30];

        for(i=0;i<w;i++) num[i] = i + 1;

        for (i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",");
            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            c = num[a];
            num[a] = num[b];
            num[b] = c;
	}

        for(i=0;i<w;i++) System.out.printf("%d\n",num[i]);

    }
}