import java.util.Scanner;

public class Main{
  public static void main (String[] args) {
    Scanner sc =new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[w];
    for(int i=0;i<w;i++){
      a[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    }
    for(int i=0;i<w;i++)
      System.out.println(a[i]);
      sc.close();
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main (String[] args) {
    Scanner sc =new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[w];
    for(int i=0;i<w;i++){
      a[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    }
    for(int i=0;i<w;i++)
      System.out.println(a[i]);
      sc.close();
  }
} Main public static void main (String[] args) {
    Scanner sc =new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[w];
    for(int i=0;i<w;i++){
      a[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    }
    for(int i=0;i<w;i++)
      System.out.println(a[i]);
      sc.close();
  } main {
    Scanner sc =new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[w];
    for(int i=0;i<w;i++){
      a[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    }
    for(int i=0;i<w;i++)
      System.out.println(a[i]);
      sc.close();
  } 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[] a = new int[w]; a new int[w] w for(int i=0;i<w;i++){
      a[i]=i+1;
    } int i=0; int i=0; i 0 i<w i w i++ i++ i {
      a[i]=i+1;
    } {
      a[i]=i+1;
    } a[i]=i+1 a[i] a i i+1 i 1 for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    } {
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    } String line = sc.next(); line sc.next() sc.next sc String[] ml =line.split(","); ml line.split(",") line.split line "," int m = Integer.parseInt(ml[0]) -1; m Integer.parseInt(ml[0]) -1 Integer.parseInt(ml[0]) Integer.parseInt Integer ml[0] ml 0 1 int l = Integer.parseInt(ml[1]) -1; l Integer.parseInt(ml[1]) -1 Integer.parseInt(ml[1]) Integer.parseInt Integer ml[1] ml 1 1 int k = a[m]; k a[m] a m a[m] = a[l] a[m] a m a[l] a l a[l] = k a[l] a l k for(int i=0;i<w;i++)
      System.out.println(a[i]); int i=0; int i=0; i 0 i<w i w i++ i++ i System.out.println(a[i]); System.out.println(a[i]) System.out.println System.out System System.out a[i] a i sc.close() sc.close sc String[] args args public class Main{
  public static void main (String[] args) {
    Scanner sc =new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[w];
    for(int i=0;i<w;i++){
      a[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    }
    for(int i=0;i<w;i++)
      System.out.println(a[i]);
      sc.close();
  }
} public class Main{
  public static void main (String[] args) {
    Scanner sc =new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[w];
    for(int i=0;i<w;i++){
      a[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    }
    for(int i=0;i<w;i++)
      System.out.println(a[i]);
      sc.close();
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main (String[] args) {
    Scanner sc =new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] a = new int[w];
    for(int i=0;i<w;i++){
      a[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String line = sc.next();
      String[] ml =line.split(",");
      int m = Integer.parseInt(ml[0]) -1;
      int l = Integer.parseInt(ml[1]) -1;
      int k = a[m];
      a[m] = a[l];
      a[l] = k;
    }
    for(int i=0;i<w;i++)
      System.out.println(a[i]);
      sc.close();
  }
}
