import java.util.Scanner;

public class Main{

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

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

  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int w = sc.nextInt();
      int[] a = new int[w+1];
      for(int i = 1; i < w+1; i++) a[i]=i;
      int n = sc.nextInt();
      for(int i = 0; i < n; i++){
          String[] s = sc.next().split(",");
          int l = Integer.parseInt(s[0]);
          int r = Integer.parseInt(s[1]);
          int exchange = a[l];
          a[l] = a[r];
          a[r] = exchange;
      }
      for(int i = 1; i < w+1; i++)System.out.println(a[i]);
  }
} 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[] a = new int[w+1];
      for(int i = 1; i < w+1; i++) a[i]=i;
      int n = sc.nextInt();
      for(int i = 0; i < n; i++){
          String[] s = sc.next().split(",");
          int l = Integer.parseInt(s[0]);
          int r = Integer.parseInt(s[1]);
          int exchange = a[l];
          a[l] = a[r];
          a[r] = exchange;
      }
      for(int i = 1; i < w+1; i++)System.out.println(a[i]);
  }
}