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

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] ac = new int[w];
    for(int i=0;i<w;i++){
      ac[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    }
    for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    }
  }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] ac = new int[w];
    for(int i=0;i<w;i++){
      ac[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    }
    for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] ac = new int[w];
    for(int i=0;i<w;i++){
      ac[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    }
    for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] ac = new int[w];
    for(int i=0;i<w;i++){
      ac[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    }
    for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] ac = new int[w]; ac new int[w] w for(int i=0;i<w;i++){
      ac[i]=i+1;
    } int i=0; int i=0; i 0 i<w i w i++ i++ i {
      ac[i]=i+1;
    } {
      ac[i]=i+1;
    } ac[i]=i+1 ac[i] ac i i+1 i 1 for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    } {
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    } String s=sc.next(); s sc.next() sc.next sc String[] ab=s.split(","); ab s.split(",") s.split s "," int a=Integer.valueOf(ab[0]); a Integer.valueOf(ab[0]) Integer.valueOf Integer ab[0] ab 0 int b=Integer.valueOf(ab[1]); b Integer.valueOf(ab[1]) Integer.valueOf Integer ab[1] ab 1 int temp = ac[a-1]; temp ac[a-1] ac a-1 a 1 ac[a-1] = ac[b-1] ac[a-1] ac a-1 a 1 ac[b-1] ac b-1 b 1 ac[b-1] = temp ac[b-1] ac b-1 b 1 temp for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    } int i=0; int i=0; i 0 i<w i w i++ i++ i {
      System.out.println(ac[i]);
    } {
      System.out.println(ac[i]);
    } System.out.println(ac[i]) System.out.println System.out System System.out ac[i] ac i String[] args args public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] ac = new int[w];
    for(int i=0;i<w;i++){
      ac[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    }
    for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    }
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] ac = new int[w];
    for(int i=0;i<w;i++){
      ac[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    }
    for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    }
  }
} Main
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt();
    int n = sc.nextInt();
    int[] ac = new int[w];
    for(int i=0;i<w;i++){
      ac[i]=i+1;
    }
    for(int i=0;i<n;i++){
      String s=sc.next();
      String[] ab=s.split(",");
      int a=Integer.valueOf(ab[0]);
      int b=Integer.valueOf(ab[1]);
      int temp = ac[a-1];
      ac[a-1] = ac[b-1];
      ac[b-1] = temp; 
    }
    for(int i=0;i<w;i++){
      System.out.println(ac[i]);
    }
  }
}
