import java.io.BufferedReader;
import java.io.IOException;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	} main {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	} BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in)); read new BufferedReader(
                new java.io.InputStreamReader(System.in)) int w = Integer.parseInt(read.readLine()); w Integer.parseInt(read.readLine()) Integer.parseInt Integer read.readLine() read.readLine read int n = Integer.parseInt(read.readLine()); n Integer.parseInt(read.readLine()) Integer.parseInt Integer read.readLine() read.readLine read int [] var = new int [w]; var new int [w] w for(int j=0;j<w;j++){
	var[j]=j+1;
} int j=0; int j=0; j 0 j<w j w j++ j++ j {
	var[j]=j+1;
} {
	var[j]=j+1;
} var[j]=j+1 var[j] var j j+1 j 1 for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      } int i=0; int i=0; i 0 i<n i n i++ i++ i {
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      } {
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      } String x[]= read.readLine().split(","); x read.readLine().split(",") read.readLine().split read.readLine() read.readLine read "," int str[] =new int[2]; str new int[2] 2 str[0]=Integer.parseInt(x[0]) str[0] str 0 Integer.parseInt(x[0]) Integer.parseInt Integer x[0] x 0 str[1]=Integer.parseInt(x[1]) str[1] str 1 Integer.parseInt(x[1]) Integer.parseInt Integer x[1] x 1 int tmp=var[str[0]-1]; tmp var[str[0]-1] var str[0]-1 str[0] str 0 1 var[str[0]-1]=var[str[1]-1] var[str[0]-1] var str[0]-1 str[0] str 0 1 var[str[1]-1] var str[1]-1 str[1] str 1 1 var[str[1]-1]=tmp var[str[1]-1] var str[1]-1 str[1] str 1 1 tmp for(int i=0;i<w;i++){
       System.out.println(var[i]);
       } int i=0; int i=0; i 0 i<w i w i++ i++ i {
       System.out.println(var[i]);
       } {
       System.out.println(var[i]);
       } System.out.println(var[i]) System.out.println System.out System System.out var[i] var i String[] args args public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	}

} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader read = new BufferedReader(
                new java.io.InputStreamReader(System.in));

       int w = Integer.parseInt(read.readLine());
       int n = Integer.parseInt(read.readLine());
       int [] var = new int [w];
for(int j=0;j<w;j++){
	var[j]=j+1;
}
//String x[] = new String[2];
       for(int i=0;i<n;i++){
    //	   System.out.println("A");
       String x[]= read.readLine().split(",");
       int str[] =new int[2];
       str[0]=Integer.parseInt(x[0]);
       str[1]=Integer.parseInt(x[1]);
    //   System.out.println("B");
       int tmp=var[str[0]-1];

       var[str[0]-1]=var[str[1]-1];
       var[str[1]-1]=tmp;
	  // System.out.println("Str"+str[0]+","+str[1]);

	//   System.out.println("var"+var[0]+","+var[1]);
       //System.out.println(z[2]);
       //System.out.println(x);
	// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
      }
       for(int i=0;i<w;i++){
       System.out.println(var[i]);
       }
	}

}