import java.io.*;

 public class Main{
	 public static void main(String args[]) throws IOException{
		 BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in));
		 int w,n,right,left,x;
		 String str;
		 w = Integer.parseInt(bf.readLine());
		 n = Integer.parseInt(bf.readLine());
		 int[] order = new int[w];
		 for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 }
		 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 }
		 for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 }
	 }
} import java.io.*; io.* java public class Main{
	 public static void main(String args[]) throws IOException{
		 BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in));
		 int w,n,right,left,x;
		 String str;
		 w = Integer.parseInt(bf.readLine());
		 n = Integer.parseInt(bf.readLine());
		 int[] order = new int[w];
		 for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 }
		 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 }
		 for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 }
	 }
} Main public static void main(String args[]) throws IOException{
		 BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in));
		 int w,n,right,left,x;
		 String str;
		 w = Integer.parseInt(bf.readLine());
		 n = Integer.parseInt(bf.readLine());
		 int[] order = new int[w];
		 for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 }
		 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 }
		 for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 }
	 } main {
		 BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in));
		 int w,n,right,left,x;
		 String str;
		 w = Integer.parseInt(bf.readLine());
		 n = Integer.parseInt(bf.readLine());
		 int[] order = new int[w];
		 for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 }
		 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 }
		 for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 }
	 } BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in)); bf new BufferedReader(
				 new InputStreamReader(System.in)) int w w n n right right left left x; x String str; str w = Integer.parseInt(bf.readLine()) w Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf n = Integer.parseInt(bf.readLine()) n Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf int[] order = new int[w]; order new int[w] w for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			 order[i] = i+1;
		 } {
			 order[i] = i+1;
		 } order[i] = i+1 order[i] order i i+1 i 1 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 } int i = 0; int i = 0; i 0 i < 2*n i 2*n 2 n i += 2 i += 2 i 2 {
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 } {
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 } str = bf.readLine() str bf.readLine() bf.readLine bf String deta[] = str.split(",",0); deta str.split(",",0) str.split str "," 0 left = Integer.parseInt(deta[0]) left Integer.parseInt(deta[0]) Integer.parseInt Integer deta[0] deta 0 right = Integer.parseInt(deta[1]) right Integer.parseInt(deta[1]) Integer.parseInt Integer deta[1] deta 1 x = order[left-1] x order[left-1] order left-1 left 1 order[left-1] =order[right-1] order[left-1] order left-1 left 1 order[right-1] order right-1 right 1 order[right-1] = x order[right-1] order right-1 right 1 x for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
			 System.out.println(order[i]);
		 } {
			 System.out.println(order[i]);
		 } System.out.println(order[i]) System.out.println System.out System System.out order[i] order i String args[] args public class Main{
	 public static void main(String args[]) throws IOException{
		 BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in));
		 int w,n,right,left,x;
		 String str;
		 w = Integer.parseInt(bf.readLine());
		 n = Integer.parseInt(bf.readLine());
		 int[] order = new int[w];
		 for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 }
		 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 }
		 for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 }
	 }
} public class Main{
	 public static void main(String args[]) throws IOException{
		 BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in));
		 int w,n,right,left,x;
		 String str;
		 w = Integer.parseInt(bf.readLine());
		 n = Integer.parseInt(bf.readLine());
		 int[] order = new int[w];
		 for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 }
		 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 }
		 for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 }
	 }
} Main
import java.io.*;

 public class Main{
	 public static void main(String args[]) throws IOException{
		 BufferedReader bf = new BufferedReader(
				 new InputStreamReader(System.in));
		 int w,n,right,left,x;
		 String str;
		 w = Integer.parseInt(bf.readLine());
		 n = Integer.parseInt(bf.readLine());
		 int[] order = new int[w];
		 for(int i = 0; i < w; i++){
			 order[i] = i+1;
		 }
		 for(int i = 0; i < 2*n; i += 2){
			 str = bf.readLine();
			 String deta[] = str.split(",",0);
			 left = Integer.parseInt(deta[0]);
			 right = Integer.parseInt(deta[1]);
			 x = order[left-1];
			 order[left-1] =order[right-1];
			 order[right-1] = x;
		 }
		 for(int i = 0; i < w; i++){
			 System.out.println(order[i]);
		 }
	 }
}