import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] num = new int[w];
    for(int i=0;i<num.length;i++){
      num[i] = i+1;
    }
    for(int j=0;j<n;j++){
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    }
    for(int k=0;k<w;k++){
      System.out.println(num[k]);
    }
  }
} import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] num = new int[w];
    for(int i=0;i<num.length;i++){
      num[i] = i+1;
    }
    for(int j=0;j<n;j++){
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    }
    for(int k=0;k<w;k++){
      System.out.println(num[k]);
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] num = new int[w];
    for(int i=0;i<num.length;i++){
      num[i] = i+1;
    }
    for(int j=0;j<n;j++){
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    }
    for(int k=0;k<w;k++){
      System.out.println(num[k]);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] num = new int[w];
    for(int i=0;i<num.length;i++){
      num[i] = i+1;
    }
    for(int j=0;j<n;j++){
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    }
    for(int k=0;k<w;k++){
      System.out.println(num[k]);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] num = new int[w]; num new int[w] w for(int i=0;i<num.length;i++){
      num[i] = i+1;
    } int i=0; int i=0; i 0 i<num.length i num.length num num.length i++ i++ i {
      num[i] = i+1;
    } {
      num[i] = i+1;
    } num[i] = i+1 num[i] num i i+1 i 1 for(int j=0;j<n;j++){
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    } int j=0; int j=0; j 0 j<n j n j++ j++ j {
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    } {
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    } String str = sc.next(); str sc.next() sc.next sc String[] ab = str.split(","); ab str.split(",") str.split str "," int a = Integer.parseInt(ab[0])-1; a Integer.parseInt(ab[0])-1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1])-1; b Integer.parseInt(ab[1])-1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 int temp = num[a]; temp num[a] num a num[a] = num[b] num[a] num a num[b] num b num[b] = temp num[b] num b temp for(int k=0;k<w;k++){
      System.out.println(num[k]);
    } int k=0; int k=0; k 0 k<w k w k++ k++ k {
      System.out.println(num[k]);
    } {
      System.out.println(num[k]);
    } System.out.println(num[k]) System.out.println System.out System System.out num[k] num k String[] args args
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] num = new int[w];
    for(int i=0;i<num.length;i++){
      num[i] = i+1;
    }
    for(int j=0;j<n;j++){
      String str = sc.next();
      String[] ab = str.split(",");
      int a = Integer.parseInt(ab[0])-1;
      int b = Integer.parseInt(ab[1])-1;
      int temp = num[a];
      num[a] = num[b];
      num[b] = temp;
    }
    for(int k=0;k<w;k++){
      System.out.println(num[k]);
    }
  }
}