import java.util.Scanner;

public class Main{

 public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int x = sc.nextInt();

  int y = sc.nextInt();

  int[] values = new int[x];

  for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  }
  for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  }
  for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  }
 }
} import java.util.Scanner; Scanner java.util public class Main{

 public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int x = sc.nextInt();

  int y = sc.nextInt();

  int[] values = new int[x];

  for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  }
  for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  }
  for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  }
 }
} Main public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int x = sc.nextInt();

  int y = sc.nextInt();

  int[] values = new int[x];

  for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  }
  for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  }
  for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  }
 } main {

  Scanner sc = new Scanner(System.in);

  int x = sc.nextInt();

  int y = sc.nextInt();

  int[] values = new int[x];

  for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  }
  for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  }
  for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  }
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc int[] values = new int[x]; values new int[x] x for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  } int i = 0; int i = 0; i 0 i < values.length i values.length values values.length i++ i++ i {

   values[i] = i +1;

  } {

   values[i] = i +1;

  } values[i] = i +1 values[i] values i i +1 i 1 for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  } int i = 0; int i = 0; i 0 i < y i y i++ i++ i {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  } {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  } String str = sc.next(); str sc.next() sc.next sc String[] ab = str.split(","); ab str.split(",") str.split str "," 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 t = values[a]; t values[a] values a values[a] = values[b] values[a] values a values[b] values b values[b] = t values[b] values b t for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  } int j=0; int j=0; j 0 j < x j x j++ j++ j {
   System.out.println(values[j]);
  } {
   System.out.println(values[j]);
  } System.out.println(values[j]) System.out.println System.out System System.out values[j] values j String[] args args public class Main{

 public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int x = sc.nextInt();

  int y = sc.nextInt();

  int[] values = new int[x];

  for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  }
  for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  }
  for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  }
 }
} public class Main{

 public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int x = sc.nextInt();

  int y = sc.nextInt();

  int[] values = new int[x];

  for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  }
  for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  }
  for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  }
 }
} Main
import java.util.Scanner;

public class Main{

 public static void main(String[] args) {

  Scanner sc = new Scanner(System.in);

  int x = sc.nextInt();

  int y = sc.nextInt();

  int[] values = new int[x];

  for (int i = 0; i < values.length; i++) {

   values[i] = i +1;

  }
  for (int i = 0; i < y; i++) {
   String str = sc.next();
   String[] ab = str.split(",");
   int a = Integer.parseInt(ab[0])-1;
   int b = Integer.parseInt(ab[1])-1;
   int t = values[a];
   values[a] = values[b];
   values[b] = t;
  }
  for (int j=0; j < x; j++) {
   System.out.println(values[j]);
  }
 }
}