import java.util.Scanner;

public class Main{


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str;
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[]  tate = new int[w];
        for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        }
        int[]   a   = new int[n];
        int[]   b   = new int[n];
        for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        }

        for(int i=0;i<w;i++){
            System.out.println(tate[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);
        String str;
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[]  tate = new int[w];
        for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        }
        int[]   a   = new int[n];
        int[]   b   = new int[n];
        for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        }

        for(int i=0;i<w;i++){
            System.out.println(tate[i]);
        }
        sc.close();
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str;
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[]  tate = new int[w];
        for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        }
        int[]   a   = new int[n];
        int[]   b   = new int[n];
        for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        }

        for(int i=0;i<w;i++){
            System.out.println(tate[i]);
        }
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String str;
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[]  tate = new int[w];
        for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        }
        int[]   a   = new int[n];
        int[]   b   = new int[n];
        for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        }

        for(int i=0;i<w;i++){
            System.out.println(tate[i]);
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str; str int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[]  tate = new int[w]; tate new int[w] w for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
        	tate[i]=i+1;
        } {
        	tate[i]=i+1;
        } tate[i]=i+1 tate[i] tate i i+1 i 1 int[]   a   = new int[n]; a new int[n] n int[]   b   = new int[n]; b new int[n] n for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        } {
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        } str = sc.next() str sc.next() sc.next sc String[] input = str.split(","); input str.split(",") str.split str "," a[i]= Integer.parseInt(input[0]) a[i] a i Integer.parseInt(input[0]) Integer.parseInt Integer input[0] input 0 b[i]= Integer.parseInt(input[1]) b[i] b i Integer.parseInt(input[1]) Integer.parseInt Integer input[1] input 1 int t=tate[a[i]-1]; t tate[a[i]-1] tate a[i]-1 a[i] a i 1 tate[a[i]-1]=tate[b[i]-1] tate[a[i]-1] tate a[i]-1 a[i] a i 1 tate[b[i]-1] tate b[i]-1 b[i] b i 1 tate[b[i]-1]=t tate[b[i]-1] tate b[i]-1 b[i] b i 1 t for(int i=0;i<w;i++){
            System.out.println(tate[i]);
        } int i=0; int i=0; i 0 i<w i w i++ i++ i {
            System.out.println(tate[i]);
        } {
            System.out.println(tate[i]);
        } System.out.println(tate[i]) System.out.println System.out System System.out tate[i] tate i sc.close() sc.close sc String[] args args public class Main{


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str;
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[]  tate = new int[w];
        for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        }
        int[]   a   = new int[n];
        int[]   b   = new int[n];
        for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        }

        for(int i=0;i<w;i++){
            System.out.println(tate[i]);
        }
        sc.close();
    }
} public class Main{


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str;
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[]  tate = new int[w];
        for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        }
        int[]   a   = new int[n];
        int[]   b   = new int[n];
        for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        }

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

public class Main{


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str;
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[]  tate = new int[w];
        for(int i=0;i<w;i++) {
        	tate[i]=i+1;
        }
        int[]   a   = new int[n];
        int[]   b   = new int[n];
        for(int i=0;i<n;i++){
        	str = sc.next();
        	String[] input = str.split(",");
            a[i]= Integer.parseInt(input[0]);
            b[i]= Integer.parseInt(input[1]);
            int t=tate[a[i]-1];
            tate[a[i]-1]=tate[b[i]-1];
            tate[b[i]-1]=t;
        }

        for(int i=0;i<w;i++){
            System.out.println(tate[i]);
        }
        sc.close();
    }
}
