import java.util.*;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  }

  private final Scanner sc = new Scanner(System.in);
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  }

  private final Scanner sc = new Scanner(System.in);
} Main private final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
    new Main().run();
  } main {
    new Main().run();
  } new Main().run() new Main().run new Main() String[] args args private void run() {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  } run {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  } int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] lines = new int[w]; lines new int[w] w for(int i = 0; i < w; i++) lines[i] = i + 1; int i = 0; int i = 0; i 0 i < w i w i++ i++ i lines[i] = i + 1; lines[i] = i + 1 lines[i] lines i i + 1 i 1 sc.useDelimiter("[,\n]") sc.useDelimiter sc "[,\n]" for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    } {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    } int a = sc.nextInt() - 1; a sc.nextInt() - 1 sc.nextInt() sc.nextInt sc 1 int b = sc.nextInt() - 1; b sc.nextInt() - 1 sc.nextInt() sc.nextInt sc 1 int tmp = lines[a]; tmp lines[a] lines a lines[a] = lines[b] lines[a] lines a lines[b] lines b lines[b] = tmp lines[b] lines b tmp for(int l : lines) {
      System.out.println(l);
    } int l lines {
      System.out.println(l);
    } {
      System.out.println(l);
    } System.out.println(l) System.out.println System.out System System.out l public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  }

  private final Scanner sc = new Scanner(System.in);
} public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  }

  private final Scanner sc = new Scanner(System.in);
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] lines = new int[w];
    for(int i = 0; i < w; i++) lines[i] = i + 1;

    sc.useDelimiter("[,\n]");

    for(int i = 0; i < n; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;

      int tmp = lines[a];
      lines[a] = lines[b];
      lines[b] = tmp;
    }

    for(int l : lines) {
      System.out.println(l);
    }
  }

  private final Scanner sc = new Scanner(System.in);
}