import java.util.Scanner;

public class Main {
  public static void swap(int[] array, int x, int y) {
    int temp = array[x];
    array[x] = array[y];
    array[y] = temp;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter("[\\s,]");

    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] order = new int[w];
    for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    }

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

    for(int i = 0; i < w; i++) {
      System.out.println(order[i]);
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void swap(int[] array, int x, int y) {
    int temp = array[x];
    array[x] = array[y];
    array[y] = temp;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter("[\\s,]");

    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] order = new int[w];
    for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    }

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

    for(int i = 0; i < w; i++) {
      System.out.println(order[i]);
    }
  }
} Main public static void swap(int[] array, int x, int y) {
    int temp = array[x];
    array[x] = array[y];
    array[y] = temp;
  } swap {
    int temp = array[x];
    array[x] = array[y];
    array[y] = temp;
  } int temp = array[x]; temp array[x] array x array[x] = array[y] array[x] array x array[y] array y array[y] = temp array[y] array y temp int[] array array int x x int y y public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter("[\\s,]");

    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] order = new int[w];
    for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    }

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

    for(int i = 0; i < w; i++) {
      System.out.println(order[i]);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter("[\\s,]");

    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] order = new int[w];
    for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    }

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

    for(int i = 0; i < w; i++) {
      System.out.println(order[i]);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) sc.useDelimiter("[\\s,]") sc.useDelimiter sc "[\\s,]" int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] order = new int[w]; order new int[w] w for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
      order[i] = i + 1;
    } {
      order[i] = i + 1;
    } order[i] = i + 1 order[i] order i i + 1 i 1 for(int i = 0; i < n; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      swap(order, a - 1, b - 1);
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      int a = sc.nextInt();
      int b = sc.nextInt();
      swap(order, a - 1, b - 1);
    } {
      int a = sc.nextInt();
      int b = sc.nextInt();
      swap(order, a - 1, b - 1);
    } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc swap(order, a - 1, b - 1) swap order a - 1 a 1 b - 1 b 1 for(int i = 0; i < w; i++) {
      System.out.println(order[i]);
    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
      System.out.println(order[i]);
    } {
      System.out.println(order[i]);
    } System.out.println(order[i]) System.out.println System.out System System.out order[i] order i String args[] args public class Main {
  public static void swap(int[] array, int x, int y) {
    int temp = array[x];
    array[x] = array[y];
    array[y] = temp;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter("[\\s,]");

    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] order = new int[w];
    for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    }

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

    for(int i = 0; i < w; i++) {
      System.out.println(order[i]);
    }
  }
} public class Main {
  public static void swap(int[] array, int x, int y) {
    int temp = array[x];
    array[x] = array[y];
    array[y] = temp;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter("[\\s,]");

    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] order = new int[w];
    for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    }

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

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

public class Main {
  public static void swap(int[] array, int x, int y) {
    int temp = array[x];
    array[x] = array[y];
    array[y] = temp;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter("[\\s,]");

    int w = sc.nextInt();
    int n = sc.nextInt();

    int[] order = new int[w];
    for(int i = 0; i < w; i++) {
      order[i] = i + 1;
    }

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

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