import java.io.*;
class Main {
  public static void main(String... args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    int w = Integer.parseInt(s);
    int[] nums = new int[w];
    for(int i = 0; i < w; i++) {
      nums[i] = i+1;
    }
    s = br.readLine();
    int n = Integer.parseInt(s);
    for(int i = 0; i < n; i++) {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    }
    for(int i = 0; i < w; i++) {
      System.out.println(nums[i]);
    }
  }
} import java.io.*; io.* java class Main {
  public static void main(String... args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    int w = Integer.parseInt(s);
    int[] nums = new int[w];
    for(int i = 0; i < w; i++) {
      nums[i] = i+1;
    }
    s = br.readLine();
    int n = Integer.parseInt(s);
    for(int i = 0; i < n; i++) {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    }
    for(int i = 0; i < w; i++) {
      System.out.println(nums[i]);
    }
  }
} Main public static void main(String... args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    int w = Integer.parseInt(s);
    int[] nums = new int[w];
    for(int i = 0; i < w; i++) {
      nums[i] = i+1;
    }
    s = br.readLine();
    int n = Integer.parseInt(s);
    for(int i = 0; i < n; i++) {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    }
    for(int i = 0; i < w; i++) {
      System.out.println(nums[i]);
    }
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    int w = Integer.parseInt(s);
    int[] nums = new int[w];
    for(int i = 0; i < w; i++) {
      nums[i] = i+1;
    }
    s = br.readLine();
    int n = Integer.parseInt(s);
    for(int i = 0; i < n; i++) {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    }
    for(int i = 0; i < w; i++) {
      System.out.println(nums[i]);
    }
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s = br.readLine(); s br.readLine() br.readLine br int w = Integer.parseInt(s); w Integer.parseInt(s) Integer.parseInt Integer s int[] nums = new int[w]; nums new int[w] w for(int i = 0; i < w; i++) {
      nums[i] = i+1;
    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
      nums[i] = i+1;
    } {
      nums[i] = i+1;
    } nums[i] = i+1 nums[i] nums i i+1 i 1 s = br.readLine() s br.readLine() br.readLine br int n = Integer.parseInt(s); n Integer.parseInt(s) Integer.parseInt Integer s for(int i = 0; i < n; i++) {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    } {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    } s = br.readLine() s br.readLine() br.readLine br String[] arr = s.split(","); arr s.split(",") s.split s "," int a = Integer.parseInt(arr[0])-1; a Integer.parseInt(arr[0])-1 Integer.parseInt(arr[0]) Integer.parseInt Integer arr[0] arr 0 1 int b = Integer.parseInt(arr[1])-1; b Integer.parseInt(arr[1])-1 Integer.parseInt(arr[1]) Integer.parseInt Integer arr[1] arr 1 1 int temp = nums[a]; temp nums[a] nums a nums[a] = nums[b] nums[a] nums a nums[b] nums b nums[b] = temp nums[b] nums b temp for(int i = 0; i < w; i++) {
      System.out.println(nums[i]);
    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
      System.out.println(nums[i]);
    } {
      System.out.println(nums[i]);
    } System.out.println(nums[i]) System.out.println System.out System System.out nums[i] nums i String... args args
import java.io.*;
class Main {
  public static void main(String... args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    int w = Integer.parseInt(s);
    int[] nums = new int[w];
    for(int i = 0; i < w; i++) {
      nums[i] = i+1;
    }
    s = br.readLine();
    int n = Integer.parseInt(s);
    for(int i = 0; i < n; i++) {
      s = br.readLine();
      String[] arr = s.split(",");
      int a = Integer.parseInt(arr[0])-1;
      int b = Integer.parseInt(arr[1])-1;
      int temp = nums[a];
      nums[a] = nums[b];
      nums[b] = temp;
    }
    for(int i = 0; i < w; i++) {
      System.out.println(nums[i]);
    }
  }
}