import java.util.*;
import java.util.regex.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt(),n = sc.nextInt(),a,b,z;
    int[] amida = new int[w];
    for(int i=0;i<w;i++)amida[i]=i+1;
    for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    }
    for(int i=0;i<w;i++)System.out.println(amida[i]);
    sc.close();
  }
} import java.util.*; util.* java import java.util.regex.*; regex.* java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt(),n = sc.nextInt(),a,b,z;
    int[] amida = new int[w];
    for(int i=0;i<w;i++)amida[i]=i+1;
    for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    }
    for(int i=0;i<w;i++)System.out.println(amida[i]);
    sc.close();
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt(),n = sc.nextInt(),a,b,z;
    int[] amida = new int[w];
    for(int i=0;i<w;i++)amida[i]=i+1;
    for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    }
    for(int i=0;i<w;i++)System.out.println(amida[i]);
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt(),n = sc.nextInt(),a,b,z;
    int[] amida = new int[w];
    for(int i=0;i<w;i++)amida[i]=i+1;
    for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    }
    for(int i=0;i<w;i++)System.out.println(amida[i]);
    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w = sc.nextInt() w sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc a a b b z; z int[] amida = new int[w]; amida new int[w] w for(int i=0;i<w;i++)amida[i]=i+1; int i=0; int i=0; i 0 i<w i w i++ i++ i amida[i]=i+1; amida[i]=i+1 amida[i] amida i i+1 i 1 for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    } {
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    } String s = sc.next(); s sc.next() sc.next sc Pattern pattern = Pattern.compile("\\D"); pattern Pattern.compile("\\D") Pattern.compile Pattern "\\D" String[] splitStr = pattern.split(s); splitStr pattern.split(s) pattern.split pattern s a = Integer.parseInt(splitStr[0]) a Integer.parseInt(splitStr[0]) Integer.parseInt Integer splitStr[0] splitStr 0 b = Integer.parseInt(splitStr[1]) b Integer.parseInt(splitStr[1]) Integer.parseInt Integer splitStr[1] splitStr 1 z = amida[a-1] z amida[a-1] amida a-1 a 1 amida[a-1] = amida[b-1] amida[a-1] amida a-1 a 1 amida[b-1] amida b-1 b 1 amida[b-1] = z amida[b-1] amida b-1 b 1 z for(int i=0;i<w;i++)System.out.println(amida[i]); int i=0; int i=0; i 0 i<w i w i++ i++ i System.out.println(amida[i]); System.out.println(amida[i]) System.out.println System.out System System.out amida[i] amida i sc.close() sc.close sc String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt(),n = sc.nextInt(),a,b,z;
    int[] amida = new int[w];
    for(int i=0;i<w;i++)amida[i]=i+1;
    for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    }
    for(int i=0;i<w;i++)System.out.println(amida[i]);
    sc.close();
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt(),n = sc.nextInt(),a,b,z;
    int[] amida = new int[w];
    for(int i=0;i<w;i++)amida[i]=i+1;
    for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    }
    for(int i=0;i<w;i++)System.out.println(amida[i]);
    sc.close();
  }
} Main
import java.util.*;
import java.util.regex.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int w = sc.nextInt(),n = sc.nextInt(),a,b,z;
    int[] amida = new int[w];
    for(int i=0;i<w;i++)amida[i]=i+1;
    for(int i=0;i<n;i++){
      String s = sc.next();
      Pattern pattern = Pattern.compile("\\D");
      String[] splitStr = pattern.split(s);
      a = Integer.parseInt(splitStr[0]);
      b = Integer.parseInt(splitStr[1]);
      z = amida[a-1];
      amida[a-1] = amida[b-1];
      amida[b-1] = z;
    }
    for(int i=0;i<w;i++)System.out.println(amida[i]);
    sc.close();
  }
}
