import java.util.Scanner;

class Main {
/*
  static int DrawingLots(int j, int i, int[][] ab, int n) {
    for (; j < n; j++) {
      if (ab[j][0] == i) return DrawingLots(j+1, ab[j][1], ab, n);
      else if (ab[j][1] == i) return DrawingLots(j+1, ab[j][0], ab, n);
    }
      return i;
  }
*/
public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);

    int w = stdIn.nextInt(); int[] ans = new int[w];
    int n = stdIn.nextInt(); 

    for (int i = 0; i < w; i++) {
      ans[i] = i+1;
    }
    for (int i = 0; i < n; i++) {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    }
/*
    for (int i = 1; i < w+1; i++) {
      int j = 0;
      ans[i] = DrawingLots(j, i, ab, n);
    }  
*/
/*
    for (int i = 1; i < w+1; i++) {
    for (int j = 1; j < w+1; j++)
      if (ans[j] == i)
      System.out.println(j);
    }
*/
    for (int i=0; i < w; i++)
    System.out.println(ans[i]);
  }
   
} import java.util.Scanner; Scanner java.util class Main {
/*
  static int DrawingLots(int j, int i, int[][] ab, int n) {
    for (; j < n; j++) {
      if (ab[j][0] == i) return DrawingLots(j+1, ab[j][1], ab, n);
      else if (ab[j][1] == i) return DrawingLots(j+1, ab[j][0], ab, n);
    }
      return i;
  }
*/
public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);

    int w = stdIn.nextInt(); int[] ans = new int[w];
    int n = stdIn.nextInt(); 

    for (int i = 0; i < w; i++) {
      ans[i] = i+1;
    }
    for (int i = 0; i < n; i++) {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    }
/*
    for (int i = 1; i < w+1; i++) {
      int j = 0;
      ans[i] = DrawingLots(j, i, ab, n);
    }  
*/
/*
    for (int i = 1; i < w+1; i++) {
    for (int j = 1; j < w+1; j++)
      if (ans[j] == i)
      System.out.println(j);
    }
*/
    for (int i=0; i < w; i++)
    System.out.println(ans[i]);
  }
   
} Main /*
  static int DrawingLots(int j, int i, int[][] ab, int n) {
    for (; j < n; j++) {
      if (ab[j][0] == i) return DrawingLots(j+1, ab[j][1], ab, n);
      else if (ab[j][1] == i) return DrawingLots(j+1, ab[j][0], ab, n);
    }
      return i;
  }
*/
public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);

    int w = stdIn.nextInt(); int[] ans = new int[w];
    int n = stdIn.nextInt(); 

    for (int i = 0; i < w; i++) {
      ans[i] = i+1;
    }
    for (int i = 0; i < n; i++) {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    }
/*
    for (int i = 1; i < w+1; i++) {
      int j = 0;
      ans[i] = DrawingLots(j, i, ab, n);
    }  
*/
/*
    for (int i = 1; i < w+1; i++) {
    for (int j = 1; j < w+1; j++)
      if (ans[j] == i)
      System.out.println(j);
    }
*/
    for (int i=0; i < w; i++)
    System.out.println(ans[i]);
  } main {
    Scanner stdIn = new Scanner(System.in);

    int w = stdIn.nextInt(); int[] ans = new int[w];
    int n = stdIn.nextInt(); 

    for (int i = 0; i < w; i++) {
      ans[i] = i+1;
    }
    for (int i = 0; i < n; i++) {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    }
/*
    for (int i = 1; i < w+1; i++) {
      int j = 0;
      ans[i] = DrawingLots(j, i, ab, n);
    }  
*/
/*
    for (int i = 1; i < w+1; i++) {
    for (int j = 1; j < w+1; j++)
      if (ans[j] == i)
      System.out.println(j);
    }
*/
    for (int i=0; i < w; i++)
    System.out.println(ans[i]);
  } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int w = stdIn.nextInt(); w stdIn.nextInt() stdIn.nextInt stdIn int[] ans = new int[w]; ans new int[w] w int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn for (int i = 0; i < w; i++) {
      ans[i] = i+1;
    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
      ans[i] = i+1;
    } {
      ans[i] = i+1;
    } ans[i] = i+1 ans[i] ans i i+1 i 1 for (int i = 0; i < n; i++) {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    } {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    } String tmp = stdIn.next(); tmp stdIn.next() stdIn.next stdIn String[] ab = tmp.split(","); ab tmp.split(",") tmp.split tmp "," int a = Integer.parseInt(ab[0]) - 1; a Integer.parseInt(ab[0]) - 1 Integer.parseInt(ab[0]) Integer.parseInt Integer ab[0] ab 0 1 int b = Integer.parseInt(ab[1]) - 1; b Integer.parseInt(ab[1]) - 1 Integer.parseInt(ab[1]) Integer.parseInt Integer ab[1] ab 1 1 int tmpnum; tmpnum tmpnum = ans[a] tmpnum ans[a] ans a ans[a] = ans[b] ans[a] ans a ans[b] ans b ans[b] = tmpnum ans[b] ans b tmpnum for (int i=0; i < w; i++)
    System.out.println(ans[i]); int i=0; int i=0; i 0 i < w i w i++ i++ i System.out.println(ans[i]); System.out.println(ans[i]) System.out.println System.out System System.out ans[i] ans i String[] args args
import java.util.Scanner;

class Main {
/*
  static int DrawingLots(int j, int i, int[][] ab, int n) {
    for (; j < n; j++) {
      if (ab[j][0] == i) return DrawingLots(j+1, ab[j][1], ab, n);
      else if (ab[j][1] == i) return DrawingLots(j+1, ab[j][0], ab, n);
    }
      return i;
  }
*/
public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);

    int w = stdIn.nextInt(); int[] ans = new int[w];
    int n = stdIn.nextInt(); 

    for (int i = 0; i < w; i++) {
      ans[i] = i+1;
    }
    for (int i = 0; i < n; i++) {
      String tmp = stdIn.next();
     String[] ab = tmp.split(",");
      int a = Integer.parseInt(ab[0]) - 1;
      int b = Integer.parseInt(ab[1]) - 1;
      int tmpnum;
      tmpnum = ans[a];
      ans[a] = ans[b];
      ans[b] = tmpnum;
    }
/*
    for (int i = 1; i < w+1; i++) {
      int j = 0;
      ans[i] = DrawingLots(j, i, ab, n);
    }  
*/
/*
    for (int i = 1; i < w+1; i++) {
    for (int j = 1; j < w+1; j++)
      if (ans[j] == i)
      System.out.println(j);
    }
*/
    for (int i=0; i < w; i++)
    System.out.println(ans[i]);
  }
   
}
