import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
  public static void main(String args[] ) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int w = Integer.parseInt(br.readLine());
    int n = Integer.parseInt(br.readLine());

    int list[] = new int[w];

    for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    }

    for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    }

    for (int i = 0; i < w; i++) {
      System.out.println(list[i]);
    }
  }
} import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String args[] ) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int w = Integer.parseInt(br.readLine());
    int n = Integer.parseInt(br.readLine());

    int list[] = new int[w];

    for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    }

    for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    }

    for (int i = 0; i < w; i++) {
      System.out.println(list[i]);
    }
  }
} Main public static void main(String args[] ) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int w = Integer.parseInt(br.readLine());
    int n = Integer.parseInt(br.readLine());

    int list[] = new int[w];

    for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    }

    for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    }

    for (int i = 0; i < w; i++) {
      System.out.println(list[i]);
    }
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int w = Integer.parseInt(br.readLine());
    int n = Integer.parseInt(br.readLine());

    int list[] = new int[w];

    for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    }

    for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    }

    for (int i = 0; i < w; i++) {
      System.out.println(list[i]);
    }
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int w = Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int list[] = new int[w]; list new int[w] w for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
      list[i] = i + 1;
    } {
      list[i] = i + 1;
    } list[i] = i + 1 list[i] list i i + 1 i 1 for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    } {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    } String s = br.readLine(); s br.readLine() br.readLine br int a = (Integer.parseInt(s.split(",")[0])-1); a (Integer.parseInt(s.split(",")[0])-1) Integer.parseInt(s.split(",")[0]) Integer.parseInt Integer s.split(",")[0] s.split(",") s.split s "," 0 1 int b = (Integer.parseInt(s.split(",")[1])-1); b (Integer.parseInt(s.split(",")[1])-1) Integer.parseInt(s.split(",")[1]) Integer.parseInt Integer s.split(",")[1] s.split(",") s.split s "," 1 1 int t = list[a]; t list[a] list a list[a] = list[b] list[a] list a list[b] list b list[b] = t list[b] list b t for (int i = 0; i < w; i++) {
      System.out.println(list[i]);
    } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
      System.out.println(list[i]);
    } {
      System.out.println(list[i]);
    } System.out.println(list[i]) System.out.println System.out System System.out list[i] list i String args[] args public class Main {
  public static void main(String args[] ) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int w = Integer.parseInt(br.readLine());
    int n = Integer.parseInt(br.readLine());

    int list[] = new int[w];

    for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    }

    for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    }

    for (int i = 0; i < w; i++) {
      System.out.println(list[i]);
    }
  }
} public class Main {
  public static void main(String args[] ) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int w = Integer.parseInt(br.readLine());
    int n = Integer.parseInt(br.readLine());

    int list[] = new int[w];

    for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    }

    for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    }

    for (int i = 0; i < w; i++) {
      System.out.println(list[i]);
    }
  }
} Main
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
  public static void main(String args[] ) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int w = Integer.parseInt(br.readLine());
    int n = Integer.parseInt(br.readLine());

    int list[] = new int[w];

    for (int i = 0; i < w; i++) {
      list[i] = i + 1;
    }

    for (int i = 0; i < n; i++) {
      String s = br.readLine();
      int a = (Integer.parseInt(s.split(",")[0])-1);
      int b = (Integer.parseInt(s.split(",")[1])-1);

      int t = list[a];
      list[a] = list[b];
      list[b] = t;
    }

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