import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter(",|\n");
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num;
        num = new int[w];
        int i;
        for(i=0;i<w;i++){
            num[i] = i+1;
        }
        for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        }
        for(i=0;i<w;i++) System.out.println(num[i]);
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter(",|\n");
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num;
        num = new int[w];
        int i;
        for(i=0;i<w;i++){
            num[i] = i+1;
        }
        for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        }
        for(i=0;i<w;i++) System.out.println(num[i]);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter(",|\n");
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num;
        num = new int[w];
        int i;
        for(i=0;i<w;i++){
            num[i] = i+1;
        }
        for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        }
        for(i=0;i<w;i++) System.out.println(num[i]);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter(",|\n");
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num;
        num = new int[w];
        int i;
        for(i=0;i<w;i++){
            num[i] = i+1;
        }
        for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        }
        for(i=0;i<w;i++) System.out.println(num[i]);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) sc.useDelimiter(",|\n") sc.useDelimiter sc ",|\n" int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] num; num num = new int[w] num new int[w] w int i; i 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] = i+1 num[i] num i i+1 i 1 for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        } int j=0; int j=0; j 0 j<n j n j++ j++ j {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        } {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        } int a = sc.nextInt() - 1; a sc.nextInt() - 1 sc.nextInt() sc.nextInt sc 1 int b = sc.nextInt() - 1; b sc.nextInt() - 1 sc.nextInt() sc.nextInt sc 1 int temp = num[a]; temp num[a] num a num[a] = num[b] num[a] num a num[b] num b num[b] = temp num[b] num b temp for(i=0;i<w;i++) System.out.println(num[i]); i=0; i=0 i 0 i<w i w i++ i++ i System.out.println(num[i]); System.out.println(num[i]) System.out.println System.out System System.out num[i] num i sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter(",|\n");
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num;
        num = new int[w];
        int i;
        for(i=0;i<w;i++){
            num[i] = i+1;
        }
        for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        }
        for(i=0;i<w;i++) System.out.println(num[i]);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter(",|\n");
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num;
        num = new int[w];
        int i;
        for(i=0;i<w;i++){
            num[i] = i+1;
        }
        for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        }
        for(i=0;i<w;i++) System.out.println(num[i]);
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter(",|\n");
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] num;
        num = new int[w];
        int i;
        for(i=0;i<w;i++){
            num[i] = i+1;
        }
        for(int j=0;j<n;j++){
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            int temp = num[a];
            num[a] = num[b];
            num[b] = temp;
        }
        for(i=0;i<w;i++) System.out.println(num[i]);
        sc.close();
    }
}
