import java.util.Scanner;

class Main {
    public static void main(String[] z) {
        Scanner sc = new Scanner(System.in);
        int[] l=new int[sc.nextInt()];
        for(int i=0;i<l.length;i++) {
            l[i]=i;
        }
        int n=sc.nextInt();
        while(n-->0) {
            String[] lines=sc.next().split(",");
            int a=Integer.parseInt(lines[0])-1;
            int b=Integer.parseInt(lines[1])-1;
            int temp=l[a];
            l[a]=l[b];
            l[b]=temp;
        }
        for(int i:l) {
            System.out.println(i+1);
        }
    }
}
 import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] z) {
        Scanner sc = new Scanner(System.in);
        int[] l=new int[sc.nextInt()];
        for(int i=0;i<l.length;i++) {
            l[i]=i;
        }
        int n=sc.nextInt();
        while(n-->0) {
            String[] lines=sc.next().split(",");
            int a=Integer.parseInt(lines[0])-1;
            int b=Integer.parseInt(lines[1])-1;
            int temp=l[a];
            l[a]=l[b];
            l[b]=temp;
        }
        for(int i:l) {
            System.out.println(i+1);
        }
    }
} Main public static void main(String[] z) {
        Scanner sc = new Scanner(System.in);
        int[] l=new int[sc.nextInt()];
        for(int i=0;i<l.length;i++) {
            l[i]=i;
        }
        int n=sc.nextInt();
        while(n-->0) {
            String[] lines=sc.next().split(",");
            int a=Integer.parseInt(lines[0])-1;
            int b=Integer.parseInt(lines[1])-1;
            int temp=l[a];
            l[a]=l[b];
            l[b]=temp;
        }
        for(int i:l) {
            System.out.println(i+1);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int[] l=new int[sc.nextInt()];
        for(int i=0;i<l.length;i++) {
            l[i]=i;
        }
        int n=sc.nextInt();
        while(n-->0) {
            String[] lines=sc.next().split(",");
            int a=Integer.parseInt(lines[0])-1;
            int b=Integer.parseInt(lines[1])-1;
            int temp=l[a];
            l[a]=l[b];
            l[b]=temp;
        }
        for(int i:l) {
            System.out.println(i+1);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] l=new int[sc.nextInt()]; l new int[sc.nextInt()] sc.nextInt() sc.nextInt sc for(int i=0;i<l.length;i++) {
            l[i]=i;
        } int i=0; int i=0; i 0 i<l.length i l.length l l.length i++ i++ i {
            l[i]=i;
        } {
            l[i]=i;
        } l[i]=i l[i] l i i int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc while(n-->0) {
            String[] lines=sc.next().split(",");
            int a=Integer.parseInt(lines[0])-1;
            int b=Integer.parseInt(lines[1])-1;
            int temp=l[a];
            l[a]=l[b];
            l[b]=temp;
        } n-->0 n-- n 0 {
            String[] lines=sc.next().split(",");
            int a=Integer.parseInt(lines[0])-1;
            int b=Integer.parseInt(lines[1])-1;
            int temp=l[a];
            l[a]=l[b];
            l[b]=temp;
        } String[] lines=sc.next().split(","); lines sc.next().split(",") sc.next().split sc.next() sc.next sc "," int a=Integer.parseInt(lines[0])-1; a Integer.parseInt(lines[0])-1 Integer.parseInt(lines[0]) Integer.parseInt Integer lines[0] lines 0 1 int b=Integer.parseInt(lines[1])-1; b Integer.parseInt(lines[1])-1 Integer.parseInt(lines[1]) Integer.parseInt Integer lines[1] lines 1 1 int temp=l[a]; temp l[a] l a l[a]=l[b] l[a] l a l[b] l b l[b]=temp l[b] l b temp for(int i:l) {
            System.out.println(i+1);
        } int i l {
            System.out.println(i+1);
        } {
            System.out.println(i+1);
        } System.out.println(i+1) System.out.println System.out System System.out i+1 i 1 String[] z z
import java.util.Scanner;

class Main {
    public static void main(String[] z) {
        Scanner sc = new Scanner(System.in);
        int[] l=new int[sc.nextInt()];
        for(int i=0;i<l.length;i++) {
            l[i]=i;
        }
        int n=sc.nextInt();
        while(n-->0) {
            String[] lines=sc.next().split(",");
            int a=Integer.parseInt(lines[0])-1;
            int b=Integer.parseInt(lines[1])-1;
            int temp=l[a];
            l[a]=l[b];
            l[b]=temp;
        }
        for(int i:l) {
            System.out.println(i+1);
        }
    }
}

