import java.util.*;
import java.text.*;
/*
Main class for AOJ where there is no input.
*/
public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int width = Integer.parseInt(sc.nextLine());
      int n = Integer.parseInt(sc.nextLine());
      String[] arr;
      int a;
      int b;
      int[] lot = new int[width];
      for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      }
      
      int temp;
      
      for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      }
      
      for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      }
      
   }//main
}//class import java.util.*; util.* java import java.text.*; text.* java public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int width = Integer.parseInt(sc.nextLine());
      int n = Integer.parseInt(sc.nextLine());
      String[] arr;
      int a;
      int b;
      int[] lot = new int[width];
      for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      }
      
      int temp;
      
      for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      }
      
      for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      }
      
   }//main
}//class Main public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int width = Integer.parseInt(sc.nextLine());
      int n = Integer.parseInt(sc.nextLine());
      String[] arr;
      int a;
      int b;
      int[] lot = new int[width];
      for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      }
      
      int temp;
      
      for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      }
      
      for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      }
      
   }//main main {
      Scanner sc = new Scanner(System.in);
      int width = Integer.parseInt(sc.nextLine());
      int n = Integer.parseInt(sc.nextLine());
      String[] arr;
      int a;
      int b;
      int[] lot = new int[width];
      for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      }
      
      int temp;
      
      for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      }
      
      for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      }
      
   } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int width = Integer.parseInt(sc.nextLine()); width Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] arr; arr int a; a int b; b int[] lot = new int[width]; lot new int[width] width for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      } int i = 0; int i = 0; i 0 i < width i width i ++ i ++ i {
         lot[i] = i + 1;
      } {
         lot[i] = i + 1;
      } lot[i] = i + 1 lot[i] lot i i + 1 i 1 int temp; temp for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      } int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      } {
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      } arr = sc.nextLine().split(",") arr sc.nextLine().split(",") sc.nextLine().split sc.nextLine() sc.nextLine sc "," a = Integer.parseInt(arr[0]) a Integer.parseInt(arr[0]) Integer.parseInt Integer arr[0] arr 0 b = Integer.parseInt(arr[1]) b Integer.parseInt(arr[1]) Integer.parseInt Integer arr[1] arr 1 temp = lot[a-1] temp lot[a-1] lot a-1 a 1 lot[a-1] = lot[b-1] lot[a-1] lot a-1 a 1 lot[b-1] lot b-1 b 1 lot[b-1] = temp lot[b-1] lot b-1 b 1 temp for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      } int i = 0; int i = 0; i 0 i < width i width i ++ i ++ i {
         System.out.println(lot[i]);
      } {
         System.out.println(lot[i]);
      } System.out.println(lot[i]) System.out.println System.out System System.out lot[i] lot i String[] args args public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int width = Integer.parseInt(sc.nextLine());
      int n = Integer.parseInt(sc.nextLine());
      String[] arr;
      int a;
      int b;
      int[] lot = new int[width];
      for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      }
      
      int temp;
      
      for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      }
      
      for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      }
      
   }//main
}//class public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int width = Integer.parseInt(sc.nextLine());
      int n = Integer.parseInt(sc.nextLine());
      String[] arr;
      int a;
      int b;
      int[] lot = new int[width];
      for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      }
      
      int temp;
      
      for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      }
      
      for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      }
      
   }//main
}//class Main
import java.util.*;
import java.text.*;
/*
Main class for AOJ where there is no input.
*/
public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int width = Integer.parseInt(sc.nextLine());
      int n = Integer.parseInt(sc.nextLine());
      String[] arr;
      int a;
      int b;
      int[] lot = new int[width];
      for(int i = 0; i < width; i ++){
         lot[i] = i + 1;
      }
      
      int temp;
      
      for(int i = 0; i < n; i ++){
         arr = sc.nextLine().split(",");
         a = Integer.parseInt(arr[0]);
         b = Integer.parseInt(arr[1]);
         
         temp = lot[a-1];
         lot[a-1] = lot[b-1];
         lot[b-1] = temp;
      }
      
      for(int i = 0; i < width; i ++){
         System.out.println(lot[i]);
      }
      
   }//main
}//class