import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int[] arr = new int[w+1];
    for(int i=0; i<=w; i++) {
      arr[i] = i;
    }
    int n = sc.nextInt();
    String drop = sc.nextLine();
    for(int i=0; i<n; i++) {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    }
    for(int i=1; i<=w; i++) {
      System.out.println(arr[i]);
    }
  }
} 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[] arr = new int[w+1];
    for(int i=0; i<=w; i++) {
      arr[i] = i;
    }
    int n = sc.nextInt();
    String drop = sc.nextLine();
    for(int i=0; i<n; i++) {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    }
    for(int i=1; i<=w; i++) {
      System.out.println(arr[i]);
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int[] arr = new int[w+1];
    for(int i=0; i<=w; i++) {
      arr[i] = i;
    }
    int n = sc.nextInt();
    String drop = sc.nextLine();
    for(int i=0; i<n; i++) {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    }
    for(int i=1; i<=w; i++) {
      System.out.println(arr[i]);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int[] arr = new int[w+1];
    for(int i=0; i<=w; i++) {
      arr[i] = i;
    }
    int n = sc.nextInt();
    String drop = sc.nextLine();
    for(int i=0; i<n; i++) {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    }
    for(int i=1; i<=w; i++) {
      System.out.println(arr[i]);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int[] arr = new int[w+1]; arr new int[w+1] w+1 w 1 for(int i=0; i<=w; i++) {
      arr[i] = i;
    } int i=0; int i=0; i 0 i<=w i w i++ i++ i {
      arr[i] = i;
    } {
      arr[i] = i;
    } arr[i] = i arr[i] arr i i int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String drop = sc.nextLine(); drop sc.nextLine() sc.nextLine sc for(int i=0; i<n; i++) {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    } {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    } String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] tmp = line.split(","); tmp line.split(",") line.split line "," int a = Integer.parseInt(tmp[0]); a Integer.parseInt(tmp[0]) Integer.parseInt Integer tmp[0] tmp 0 int b = Integer.parseInt(tmp[1]); b Integer.parseInt(tmp[1]) Integer.parseInt Integer tmp[1] tmp 1 int c = arr[a]; c arr[a] arr a arr[a] = arr[b] arr[a] arr a arr[b] arr b arr[b] = c arr[b] arr b c for(int i=1; i<=w; i++) {
      System.out.println(arr[i]);
    } int i=1; int i=1; i 1 i<=w i w i++ i++ i {
      System.out.println(arr[i]);
    } {
      System.out.println(arr[i]);
    } System.out.println(arr[i]) System.out.println System.out System System.out arr[i] arr i 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[] arr = new int[w+1];
    for(int i=0; i<=w; i++) {
      arr[i] = i;
    }
    int n = sc.nextInt();
    String drop = sc.nextLine();
    for(int i=0; i<n; i++) {
      String line = sc.nextLine();
      String[] tmp = line.split(",");
      int a = Integer.parseInt(tmp[0]);
      int b = Integer.parseInt(tmp[1]);
      int c = arr[a];
      arr[a] = arr[b];
      arr[b] = c;
    }
    for(int i=1; i<=w; i++) {
      System.out.println(arr[i]);
    }
  }
}