import java.util.*;

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

    int w=sc.nextInt();
    int string[] = new int[w];

    for(int i=0; i<w; i++) string[i] = i+1;

    int n=sc.nextInt();
    int a[] = new int [n];
    int b[] = new int [n];
    int times=0;
    int chg=0;

    while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    }

    for(int i=0; i<w; i++) System.out.println(string[i]);
  }
}
 import java.util.*; util.* java public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter(",|\n");

    int w=sc.nextInt();
    int string[] = new int[w];

    for(int i=0; i<w; i++) string[i] = i+1;

    int n=sc.nextInt();
    int a[] = new int [n];
    int b[] = new int [n];
    int times=0;
    int chg=0;

    while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    }

    for(int i=0; i<w; i++) System.out.println(string[i]);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter(",|\n");

    int w=sc.nextInt();
    int string[] = new int[w];

    for(int i=0; i<w; i++) string[i] = i+1;

    int n=sc.nextInt();
    int a[] = new int [n];
    int b[] = new int [n];
    int times=0;
    int chg=0;

    while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    }

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

    int w=sc.nextInt();
    int string[] = new int[w];

    for(int i=0; i<w; i++) string[i] = i+1;

    int n=sc.nextInt();
    int a[] = new int [n];
    int b[] = new int [n];
    int times=0;
    int chg=0;

    while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    }

    for(int i=0; i<w; i++) System.out.println(string[i]);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) sc.useDelimiter(",|\n") sc.useDelimiter sc ",|\n" int w=sc.nextInt(); w sc.nextInt() sc.nextInt sc int string[] = new int[w]; string new int[w] w for(int i=0; i<w; i++) string[i] = i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i string[i] = i+1; string[i] = i+1 string[i] string i i+1 i 1 int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int a[] = new int [n]; a new int [n] n int b[] = new int [n]; b new int [n] n int times=0; times 0 int chg=0; chg 0 while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    } times<n times n {
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    } a[times]=sc.nextInt() a[times] a times sc.nextInt() sc.nextInt sc b[times]=sc.nextInt() b[times] b times sc.nextInt() sc.nextInt sc chg=string[(a[times]-1)] chg string[(a[times]-1)] string (a[times]-1) a[times] a times 1 string[(a[times]-1)]=string[(b[times]-1)] string[(a[times]-1)] string (a[times]-1) a[times] a times 1 string[(b[times]-1)] string (b[times]-1) b[times] b times 1 string[(b[times]-1)]=chg string[(b[times]-1)] string (b[times]-1) b[times] b times 1 chg times++ times for(int i=0; i<w; i++) System.out.println(string[i]); int i=0; int i=0; i 0 i<w i w i++ i++ i System.out.println(string[i]); System.out.println(string[i]) System.out.println System.out System System.out string[i] string i String[] args args public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter(",|\n");

    int w=sc.nextInt();
    int string[] = new int[w];

    for(int i=0; i<w; i++) string[i] = i+1;

    int n=sc.nextInt();
    int a[] = new int [n];
    int b[] = new int [n];
    int times=0;
    int chg=0;

    while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    }

    for(int i=0; i<w; i++) System.out.println(string[i]);
  }
} public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    sc.useDelimiter(",|\n");

    int w=sc.nextInt();
    int string[] = new int[w];

    for(int i=0; i<w; i++) string[i] = i+1;

    int n=sc.nextInt();
    int a[] = new int [n];
    int b[] = new int [n];
    int times=0;
    int chg=0;

    while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    }

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

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

    int w=sc.nextInt();
    int string[] = new int[w];

    for(int i=0; i<w; i++) string[i] = i+1;

    int n=sc.nextInt();
    int a[] = new int [n];
    int b[] = new int [n];
    int times=0;
    int chg=0;

    while(times<n){
      a[times]=sc.nextInt();
      b[times]=sc.nextInt();

      chg=string[(a[times]-1)];
      string[(a[times]-1)]=string[(b[times]-1)];
      string[(b[times]-1)]=chg;

      times++;
    }

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

