import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] array = new int[30];

    int w = scanner.nextInt();
    for (int i = 0; i < w; ++i) array[i] = i + 1;

    int n = scanner.nextInt();

    for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    }

    for (int i = 0; i < w; ++i) System.out.println(array[i]);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] array = new int[30];

    int w = scanner.nextInt();
    for (int i = 0; i < w; ++i) array[i] = i + 1;

    int n = scanner.nextInt();

    for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    }

    for (int i = 0; i < w; ++i) System.out.println(array[i]);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] array = new int[30];

    int w = scanner.nextInt();
    for (int i = 0; i < w; ++i) array[i] = i + 1;

    int n = scanner.nextInt();

    for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    }

    for (int i = 0; i < w; ++i) System.out.println(array[i]);
  } main {
    Scanner scanner = new Scanner(System.in);
    int[] array = new int[30];

    int w = scanner.nextInt();
    for (int i = 0; i < w; ++i) array[i] = i + 1;

    int n = scanner.nextInt();

    for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    }

    for (int i = 0; i < w; ++i) System.out.println(array[i]);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int[] array = new int[30]; array new int[30] 30 int w = scanner.nextInt(); w scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < w; ++i) array[i] = i + 1; int i = 0; int i = 0; i 0 i < w i w ++i ++i i array[i] = i + 1; array[i] = i + 1 array[i] array i i + 1 i 1 int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    } {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    } int temp temp a a b; b String str = scanner.next(); str scanner.next() scanner.next scanner String[] num = str.split(","); num str.split(",") str.split str "," temp = array[a = (Integer.parseInt(num[0]) - 1)] temp array[a = (Integer.parseInt(num[0]) - 1)] array a = (Integer.parseInt(num[0]) - 1) a (Integer.parseInt(num[0]) - 1) Integer.parseInt(num[0]) Integer.parseInt Integer num[0] num 0 1 array[a] = array[b = (Integer.parseInt(num[1]) - 1)] array[a] array a array[b = (Integer.parseInt(num[1]) - 1)] array b = (Integer.parseInt(num[1]) - 1) b (Integer.parseInt(num[1]) - 1) Integer.parseInt(num[1]) Integer.parseInt Integer num[1] num 1 1 array[b] = temp array[b] array b temp for (int i = 0; i < w; ++i) System.out.println(array[i]); int i = 0; int i = 0; i 0 i < w i w ++i ++i i System.out.println(array[i]); System.out.println(array[i]) System.out.println System.out System System.out array[i] array i String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] array = new int[30];

    int w = scanner.nextInt();
    for (int i = 0; i < w; ++i) array[i] = i + 1;

    int n = scanner.nextInt();

    for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    }

    for (int i = 0; i < w; ++i) System.out.println(array[i]);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] array = new int[30];

    int w = scanner.nextInt();
    for (int i = 0; i < w; ++i) array[i] = i + 1;

    int n = scanner.nextInt();

    for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    }

    for (int i = 0; i < w; ++i) System.out.println(array[i]);
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int[] array = new int[30];

    int w = scanner.nextInt();
    for (int i = 0; i < w; ++i) array[i] = i + 1;

    int n = scanner.nextInt();

    for (int i = 0; i < n; ++i) {
      int temp, a , b;
      String str = scanner.next();
      String[] num = str.split(",");
      temp = array[a = (Integer.parseInt(num[0]) - 1)];
      array[a] = array[b = (Integer.parseInt(num[1]) - 1)];
      array[b] = temp;
    }

    for (int i = 0; i < w; ++i) System.out.println(array[i]);
  }
}
