public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int w, n;
    int[] a;
    int i, j, k, x, y, t, tmp;
    String str;
    char[] ch;

    w = sc.nextInt();
    n = sc.nextInt();
    a = new int[w];
    for(i = 0;i < w;i++)a[i] = i;

    for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    }

    for(i = 0;i < w;i++)out.println(a[i] + 1);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int w, n;
    int[] a;
    int i, j, k, x, y, t, tmp;
    String str;
    char[] ch;

    w = sc.nextInt();
    n = sc.nextInt();
    a = new int[w];
    for(i = 0;i < w;i++)a[i] = i;

    for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    }

    for(i = 0;i < w;i++)out.println(a[i] + 1);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} Main public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int w, n;
    int[] a;
    int i, j, k, x, y, t, tmp;
    String str;
    char[] ch;

    w = sc.nextInt();
    n = sc.nextInt();
    a = new int[w];
    for(i = 0;i < w;i++)a[i] = i;

    for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    }

    for(i = 0;i < w;i++)out.println(a[i] + 1);

    sc.close();
  } run {
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int w, n;
    int[] a;
    int i, j, k, x, y, t, tmp;
    String str;
    char[] ch;

    w = sc.nextInt();
    n = sc.nextInt();
    a = new int[w];
    for(i = 0;i < w;i++)a[i] = i;

    for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    }

    for(i = 0;i < w;i++)out.println(a[i] + 1);

    sc.close();
  } java.util.Scanner sc = new java.util.Scanner(in); sc new java.util.Scanner(in) int w w n; n int[] a; a int i i j j k k x x y y t t tmp; tmp String str; str char[] ch; ch w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc a = new int[w] a new int[w] w for(i = 0;i < w;i++)a[i] = i; i = 0; i = 0 i 0 i < w i w i++ i++ i a[i] = i; a[i] = i a[i] a i i for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    } i = 0; i = 0 i 0 i < n i n i++ i++ i {
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    } {
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    } str = sc.next() str sc.next() sc.next sc ch = new char[str.length()] ch new char[str.length()] str.length() str.length str x = 0 x 0 y = 0 y 0 for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      } j = 0; j = 0 j 0 j < str.length() j str.length() str.length str j++ j++ j {
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      } {
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      } if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j); str.charAt(j) == ',' str.charAt(j) str.charAt str j ',' {
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        } t = 1 t 1 for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          } k = 0; k = 0 k 0 k < j k j k++ k++ k {
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          } {
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          } x += t * (int)(ch[j - 1 - k] - '0') x t * (int)(ch[j - 1 - k] - '0') t (int)(ch[j - 1 - k] - '0') ch[j - 1 - k] ch j - 1 - k j - 1 - k j 1 k '0' t *= 10 t 10 j++ j break; ch[j] = str.charAt(j) ch[j] ch j str.charAt(j) str.charAt str j t = 1 t 1 for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      } k = str.length() - 1; k = str.length() - 1 k str.length() - 1 str.length() str.length str 1 k >= j k j k-- k-- k {
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      } {
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      } ch[k] = str.charAt(k) ch[k] ch k str.charAt(k) str.charAt str k y += (int)(ch[k] - '0') * t y (int)(ch[k] - '0') * t (int)(ch[k] - '0') ch[k] ch k '0' t t *= 10 t 10 tmp = a[x - 1] tmp a[x - 1] a x - 1 x 1 a[x - 1] = a[y - 1] a[x - 1] a x - 1 x 1 a[y - 1] a y - 1 y 1 a[y - 1] = tmp a[y - 1] a y - 1 y 1 tmp for(i = 0;i < w;i++)out.println(a[i] + 1); i = 0; i = 0 i 0 i < w i w i++ i++ i out.println(a[i] + 1); out.println(a[i] + 1) out.println out a[i] + 1 a[i] a i 1 sc.close() sc.close sc java.io.InputStream in in java.io.PrintStream out out public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  } main {
    (new Main()).run(System.in, System.out);
  } (new Main()).run(System.in, System.out) (new Main()).run (new Main()) System.in System System.in System.out System System.out String[] args args public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int w, n;
    int[] a;
    int i, j, k, x, y, t, tmp;
    String str;
    char[] ch;

    w = sc.nextInt();
    n = sc.nextInt();
    a = new int[w];
    for(i = 0;i < w;i++)a[i] = i;

    for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    }

    for(i = 0;i < w;i++)out.println(a[i] + 1);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int w, n;
    int[] a;
    int i, j, k, x, y, t, tmp;
    String str;
    char[] ch;

    w = sc.nextInt();
    n = sc.nextInt();
    a = new int[w];
    for(i = 0;i < w;i++)a[i] = i;

    for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    }

    for(i = 0;i < w;i++)out.println(a[i] + 1);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} Main
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int w, n;
    int[] a;
    int i, j, k, x, y, t, tmp;
    String str;
    char[] ch;

    w = sc.nextInt();
    n = sc.nextInt();
    a = new int[w];
    for(i = 0;i < w;i++)a[i] = i;

    for(i = 0;i < n;i++){
      str = sc.next();
      ch = new char[str.length()];
      x = 0; y = 0;

      for(j = 0;j < str.length();j++){
        if(str.charAt(j) == ','){
          t = 1;
          for(k = 0;k < j;k++){
            x += t * (int)(ch[j - 1 - k] - '0');
            t *= 10;
          }
          j++; break;
        }else ch[j] = str.charAt(j);
      }

      t = 1;
      for(k = str.length() - 1;k >= j;k--){
        ch[k] = str.charAt(k);
        y += (int)(ch[k] - '0') * t;
        t *= 10;
      }
      tmp = a[x - 1]; a[x - 1] = a[y - 1]; a[y - 1] = tmp;
    }

    for(i = 0;i < w;i++)out.println(a[i] + 1);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}