import java.io.*;
 
public class Main{
    public static void main(String[] args){
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    }
} import java.io.*; io.* java public class Main{
    public static void main(String[] args){
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    }
} Main public static void main(String[] args){
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    } main {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    } BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String s s t t u; u int a a b b hako; hako hako=0 hako 0 String[] abc=new String[2]; abc new String[2] 2 int[] xyz=new int[2]; xyz new int[2] 2 try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        } catch(IOException e){
            System.out.println(e);
        } IOException e {
            System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e {
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        } s=reader.readLine() s reader.readLine() reader.readLine reader t=reader.readLine() t reader.readLine() reader.readLine reader a=Integer.parseInt(s) a Integer.parseInt(s) Integer.parseInt Integer s b=Integer.parseInt(t) b Integer.parseInt(t) Integer.parseInt Integer t int[] x=new int[a+1]; x new int[a+1] a+1 a 1 x[0]=0 x[0] x 0 0 for(int j=1;j<(a+1);j++){
                    x[j]=j;
                } int j=1; int j=1; j 1 j<(a+1) j (a+1) a 1 j++ j++ j {
                    x[j]=j;
                } {
                    x[j]=j;
                } x[j]=j x[j] x j j for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                } int i=0; int i=0; i 0 i<b i b i++ i++ i {
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                } {
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                } u=reader.readLine() u reader.readLine() reader.readLine reader abc=u.split(",") abc u.split(",") u.split u "," for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    } int k=0; int k=0; k 0 k<2 k 2 k++ k++ k {
                        xyz[k]=Integer.parseInt(abc[k]);
                    } {
                        xyz[k]=Integer.parseInt(abc[k]);
                    } xyz[k]=Integer.parseInt(abc[k]) xyz[k] xyz k Integer.parseInt(abc[k]) Integer.parseInt Integer abc[k] abc k hako=x[xyz[0]] hako x[xyz[0]] x xyz[0] xyz 0 x[xyz[0]]=x[xyz[1]] x[xyz[0]] x xyz[0] xyz 0 x[xyz[1]] x xyz[1] xyz 1 x[xyz[1]]=hako x[xyz[1]] x xyz[1] xyz 1 hako for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                } int l=1; int l=1; l 1 l<(a+1) l (a+1) a 1 l++ l++ l {
                    System.out.println(x[l]);
                } {
                    System.out.println(x[l]);
                } System.out.println(x[l]) System.out.println System.out System System.out x[l] x l String[] args args public class Main{
    public static void main(String[] args){
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    }
} public class Main{
    public static void main(String[] args){
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    }
} Main
import java.io.*;
 
public class Main{
    public static void main(String[] args){
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String s,t,u;
        int a,b,hako;
        hako=0;
        String[] abc=new String[2];
        int[] xyz=new int[2];
        try{
                s=reader.readLine();
                t=reader.readLine();
                a=Integer.parseInt(s);
                b=Integer.parseInt(t);
                int[] x=new int[a+1];
                x[0]=0;
                for(int j=1;j<(a+1);j++){
                    x[j]=j;
                }
                for(int i=0;i<b;i++){
                    u=reader.readLine();
                    abc=u.split(",");
                    for(int k=0;k<2;k++){
                        xyz[k]=Integer.parseInt(abc[k]);
                    }
                    hako=x[xyz[0]];;
                    x[xyz[0]]=x[xyz[1]];
                    x[xyz[1]]=hako;
                }
                for(int l=1;l<(a+1);l++){
                    System.out.println(x[l]);
                }
        }catch(IOException e){
            System.out.println(e);
        }
    }
}