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