import java.util.ArrayList;
import java.util.Scanner;

public class Main {

  public static void swap(ArrayList<Integer> list, int a, int b){
    int c = list.get(a);
    list.set(a, list.get(b));
    list.set(b, c);
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    }
    sc.close();
  }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

  public static void swap(ArrayList<Integer> list, int a, int b){
    int c = list.get(a);
    list.set(a, list.get(b));
    list.set(b, c);
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    }
    sc.close();
  }
} Main public static void swap(ArrayList<Integer> list, int a, int b){
    int c = list.get(a);
    list.set(a, list.get(b));
    list.set(b, c);
  } swap {
    int c = list.get(a);
    list.set(a, list.get(b));
    list.set(b, c);
  } int c = list.get(a); c list.get(a) list.get list a list.set(a, list.get(b)) list.set list a list.get(b) list.get list b list.set(b, c) list.set list b c ArrayList<Integer> list list int a a int b b public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    }
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    }
    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    } catch (Exception e) {
    } Exception e {
    } {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i=1;i<=w;i++){
        list.add(i);
      } int i=1; int i=1; i 1 i<=w i w i++ i++ i {
        list.add(i);
      } {
        list.add(i);
      } list.add(i) list.add list i for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      } int i=0; int i=0; i 0 i<n i n i++ i++ i {
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      } {
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      } String[] s = sc.next().split(","); s sc.next().split(",") sc.next().split sc.next() sc.next sc "," int a = Integer.parseInt(s[0]); a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int b = Integer.parseInt(s[1]); b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 swap(list, a-1, b-1) swap list a-1 a 1 b-1 b 1 for(Integer num : list){
        System.out.println(num);
      } Integer num list {
        System.out.println(num);
      } {
        System.out.println(num);
      } System.out.println(num) System.out.println System.out System System.out num sc.close() sc.close sc String[] args args public class Main {

  public static void swap(ArrayList<Integer> list, int a, int b){
    int c = list.get(a);
    list.set(a, list.get(b));
    list.set(b, c);
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    }
    sc.close();
  }
} public class Main {

  public static void swap(ArrayList<Integer> list, int a, int b){
    int c = list.get(a);
    list.set(a, list.get(b));
    list.set(b, c);
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    }
    sc.close();
  }
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

  public static void swap(ArrayList<Integer> list, int a, int b){
    int c = list.get(a);
    list.set(a, list.get(b));
    list.set(b, c);
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> list = new ArrayList<>();
    try {
      int w = sc.nextInt();
      int n = sc.nextInt();
      for(int i=1;i<=w;i++){
        list.add(i);
      }
      for(int i=0;i<n;i++){
        String[] s = sc.next().split(",");
        int a = Integer.parseInt(s[0]);
        int b = Integer.parseInt(s[1]);
        swap(list, a-1, b-1);
      }
      for(Integer num : list){
        System.out.println(num);
      }
    } catch (Exception e) {
    }
    sc.close();
  }
}
