import java.io.*;

public class Main{
  public static void main(String[] args){
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int w, n;
    try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){}
  }

  public static void swap(int a1, int a2, int[] b){
    int tmp = b[a1];
    b[a1] =  b[a2];
    b[a2] = tmp;
  }
} import java.io.*; io.* java public class Main{
  public static void main(String[] args){
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int w, n;
    try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){}
  }

  public static void swap(int a1, int a2, int[] b){
    int tmp = b[a1];
    b[a1] =  b[a2];
    b[a2] = tmp;
  }
} Main public static void main(String[] args){
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int w, n;
    try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){}
  } main {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int w, n;
    try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){}
  } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int w w n; n try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){} catch(Exception e){} Exception e {} {
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    } w = Integer.parseInt(reader.readLine()) w Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader n = Integer.parseInt(reader.readLine()) n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] b = new int[w]; b new int[w] w for(int i = 0; i < w; i++){b[i] = i;} int i = 0; int i = 0; i 0 i < w i w i++ i++ i {b[i] = i;} {b[i] = i;} b[i] = i b[i] b i i for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      } {
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      } String a = reader.readLine(); a reader.readLine() reader.readLine reader String[] s = a.split(",", 0); s a.split(",", 0) a.split a "," 0 swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b) swap Integer.parseInt(s[0]) - 1 Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 1 Integer.parseInt(s[1]) - 1 Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 1 b for(int v: b) System.out.printf("%d\n", v + 1); int v b System.out.printf("%d\n", v + 1); System.out.printf("%d\n", v + 1) System.out.printf System.out System System.out "%d\n" v + 1 v 1 String[] args args public static void swap(int a1, int a2, int[] b){
    int tmp = b[a1];
    b[a1] =  b[a2];
    b[a2] = tmp;
  } swap {
    int tmp = b[a1];
    b[a1] =  b[a2];
    b[a2] = tmp;
  } int tmp = b[a1]; tmp b[a1] b a1 b[a1] =  b[a2] b[a1] b a1 b[a2] b a2 b[a2] = tmp b[a2] b a2 tmp int a1 a1 int a2 a2 int[] b b public class Main{
  public static void main(String[] args){
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int w, n;
    try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){}
  }

  public static void swap(int a1, int a2, int[] b){
    int tmp = b[a1];
    b[a1] =  b[a2];
    b[a2] = tmp;
  }
} public class Main{
  public static void main(String[] args){
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int w, n;
    try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){}
  }

  public static void swap(int a1, int a2, int[] b){
    int tmp = b[a1];
    b[a1] =  b[a2];
    b[a2] = tmp;
  }
} Main
import java.io.*;

public class Main{
  public static void main(String[] args){
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int w, n;
    try{
      w = Integer.parseInt(reader.readLine());
      n = Integer.parseInt(reader.readLine());
      int[] b = new int[w];
      for(int i = 0; i < w; i++){b[i] = i;}
      for(int i = 0; i < n; i++){
        String a = reader.readLine();
        String[] s = a.split(",", 0);
        swap(Integer.parseInt(s[0]) - 1, Integer.parseInt(s[1]) - 1, b);
      }
      for(int v: b) System.out.printf("%d\n", v + 1);
    }catch(Exception e){}
  }

  public static void swap(int a1, int a2, int[] b){
    int tmp = b[a1];
    b[a1] =  b[a2];
    b[a2] = tmp;
  }
}
