import java.util.Scanner;

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

        w=scan.nextInt();
        n=scan.nextInt();
        num = new int[w];
        for(i=0;i<w;i++){
            num[i]=i+1;
        }

        for(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        }

        for(i=0;i<w;i++){
            System.out.println(num[i]);
        }

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

        w=scan.nextInt();
        n=scan.nextInt();
        num = new int[w];
        for(i=0;i<w;i++){
            num[i]=i+1;
        }

        for(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        }

        for(i=0;i<w;i++){
            System.out.println(num[i]);
        }

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

        w=scan.nextInt();
        n=scan.nextInt();
        num = new int[w];
        for(i=0;i<w;i++){
            num[i]=i+1;
        }

        for(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        }

        for(i=0;i<w;i++){
            System.out.println(num[i]);
        }

    } main {
        Scanner scan = new Scanner(System.in);
        int w,n,i,temp;
        int[] num;
        String line;

        w=scan.nextInt();
        n=scan.nextInt();
        num = new int[w];
        for(i=0;i<w;i++){
            num[i]=i+1;
        }

        for(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        }

        for(i=0;i<w;i++){
            System.out.println(num[i]);
        }

    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int w w n n i i temp; temp int[] num; num String line; line w=scan.nextInt() w scan.nextInt() scan.nextInt scan n=scan.nextInt() n scan.nextInt() scan.nextInt scan num = new int[w] num new int[w] w 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(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

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

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        } {
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        } line=scan.next() line scan.next() scan.next scan String[] ab = line.split(","); ab line.split(",") line.split line "," int a = Integer.parseInt(ab[0]); a Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 int b = Integer.parseInt(ab[1]); b Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 temp=num[a-1] temp 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]=temp num[b-1] num b-1 b 1 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(num[i]) System.out.println System.out System System.out num[i] num i String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int w,n,i,temp;
        int[] num;
        String line;

        w=scan.nextInt();
        n=scan.nextInt();
        num = new int[w];
        for(i=0;i<w;i++){
            num[i]=i+1;
        }

        for(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        }

        for(i=0;i<w;i++){
            System.out.println(num[i]);
        }

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

        w=scan.nextInt();
        n=scan.nextInt();
        num = new int[w];
        for(i=0;i<w;i++){
            num[i]=i+1;
        }

        for(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        }

        for(i=0;i<w;i++){
            System.out.println(num[i]);
        }

    }
} Main
import java.util.Scanner;

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

        w=scan.nextInt();
        n=scan.nextInt();
        num = new int[w];
        for(i=0;i<w;i++){
            num[i]=i+1;
        }

        for(i=0;i<n;i++){
            line=scan.next();
            String[] ab = line.split(",");
            int a = Integer.parseInt(ab[0]);
            int b = Integer.parseInt(ab[1]);

            temp=num[a-1];
            num[a-1]=num[b-1];
            num[b-1]=temp;
        }

        for(i=0;i<w;i++){
            System.out.println(num[i]);
        }

    }
}
