import java.util.*;
import java.math.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int vNum = scanner.nextInt();
    int hNum = scanner.nextInt();

    int[] v = new int[vNum];
    for (int ii = 0; ii < v.length; ii++) {
      v[ii] = ii + 1;
    }

    String[] h = new String[hNum];
    for (int ii = 0; ii < h.length; ii++) {
      h[ii] = scanner.next();
    }

    for (int ii = 0; ii < h.length; ii++) {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    }

    for (int ii = 0; ii < v.length; ii++) {
      System.out.println(v[ii]);
    }
  }
} import java.util.*; util.* java import java.math.*; math.* java class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int vNum = scanner.nextInt();
    int hNum = scanner.nextInt();

    int[] v = new int[vNum];
    for (int ii = 0; ii < v.length; ii++) {
      v[ii] = ii + 1;
    }

    String[] h = new String[hNum];
    for (int ii = 0; ii < h.length; ii++) {
      h[ii] = scanner.next();
    }

    for (int ii = 0; ii < h.length; ii++) {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    }

    for (int ii = 0; ii < v.length; ii++) {
      System.out.println(v[ii]);
    }
  }
} Main public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int vNum = scanner.nextInt();
    int hNum = scanner.nextInt();

    int[] v = new int[vNum];
    for (int ii = 0; ii < v.length; ii++) {
      v[ii] = ii + 1;
    }

    String[] h = new String[hNum];
    for (int ii = 0; ii < h.length; ii++) {
      h[ii] = scanner.next();
    }

    for (int ii = 0; ii < h.length; ii++) {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    }

    for (int ii = 0; ii < v.length; ii++) {
      System.out.println(v[ii]);
    }
  } main {
    Scanner scanner = new Scanner(System.in);
    int vNum = scanner.nextInt();
    int hNum = scanner.nextInt();

    int[] v = new int[vNum];
    for (int ii = 0; ii < v.length; ii++) {
      v[ii] = ii + 1;
    }

    String[] h = new String[hNum];
    for (int ii = 0; ii < h.length; ii++) {
      h[ii] = scanner.next();
    }

    for (int ii = 0; ii < h.length; ii++) {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    }

    for (int ii = 0; ii < v.length; ii++) {
      System.out.println(v[ii]);
    }
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int vNum = scanner.nextInt(); vNum scanner.nextInt() scanner.nextInt scanner int hNum = scanner.nextInt(); hNum scanner.nextInt() scanner.nextInt scanner int[] v = new int[vNum]; v new int[vNum] vNum for (int ii = 0; ii < v.length; ii++) {
      v[ii] = ii + 1;
    } int ii = 0; int ii = 0; ii 0 ii < v.length ii v.length v v.length ii++ ii++ ii {
      v[ii] = ii + 1;
    } {
      v[ii] = ii + 1;
    } v[ii] = ii + 1 v[ii] v ii ii + 1 ii 1 String[] h = new String[hNum]; h new String[hNum] hNum for (int ii = 0; ii < h.length; ii++) {
      h[ii] = scanner.next();
    } int ii = 0; int ii = 0; ii 0 ii < h.length ii h.length h h.length ii++ ii++ ii {
      h[ii] = scanner.next();
    } {
      h[ii] = scanner.next();
    } h[ii] = scanner.next() h[ii] h ii scanner.next() scanner.next scanner for (int ii = 0; ii < h.length; ii++) {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    } int ii = 0; int ii = 0; ii 0 ii < h.length ii h.length h h.length ii++ ii++ ii {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    } {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    } String[] hs = h[ii].split(","); hs h[ii].split(",") h[ii].split h[ii] h ii "," int[] hwork = new int[2]; hwork new int[2] 2 hwork[0] = Integer.parseInt(hs[0]) - 1 hwork[0] hwork 0 Integer.parseInt(hs[0]) - 1 Integer.parseInt(hs[0]) Integer.parseInt Integer hs[0] hs 0 1 hwork[1] = Integer.parseInt(hs[1]) - 1 hwork[1] hwork 1 Integer.parseInt(hs[1]) - 1 Integer.parseInt(hs[1]) Integer.parseInt Integer hs[1] hs 1 1 v[hwork[0]] = v[hwork[0]] + v[hwork[1]] v[hwork[0]] v hwork[0] hwork 0 v[hwork[0]] + v[hwork[1]] v[hwork[0]] v hwork[0] hwork 0 v[hwork[1]] v hwork[1] hwork 1 v[hwork[1]] = v[hwork[0]] - v[hwork[1]] v[hwork[1]] v hwork[1] hwork 1 v[hwork[0]] - v[hwork[1]] v[hwork[0]] v hwork[0] hwork 0 v[hwork[1]] v hwork[1] hwork 1 v[hwork[0]] = v[hwork[0]] - v[hwork[1]] v[hwork[0]] v hwork[0] hwork 0 v[hwork[0]] - v[hwork[1]] v[hwork[0]] v hwork[0] hwork 0 v[hwork[1]] v hwork[1] hwork 1 for (int ii = 0; ii < v.length; ii++) {
      System.out.println(v[ii]);
    } int ii = 0; int ii = 0; ii 0 ii < v.length ii v.length v v.length ii++ ii++ ii {
      System.out.println(v[ii]);
    } {
      System.out.println(v[ii]);
    } System.out.println(v[ii]) System.out.println System.out System System.out v[ii] v ii String[] args args
import java.util.*;
import java.math.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    int vNum = scanner.nextInt();
    int hNum = scanner.nextInt();

    int[] v = new int[vNum];
    for (int ii = 0; ii < v.length; ii++) {
      v[ii] = ii + 1;
    }

    String[] h = new String[hNum];
    for (int ii = 0; ii < h.length; ii++) {
      h[ii] = scanner.next();
    }

    for (int ii = 0; ii < h.length; ii++) {
      String[] hs = h[ii].split(",");
      int[] hwork = new int[2];
      hwork[0] = Integer.parseInt(hs[0]) - 1;
      hwork[1] = Integer.parseInt(hs[1]) - 1;
      v[hwork[0]] = v[hwork[0]] + v[hwork[1]];
      v[hwork[1]] = v[hwork[0]] - v[hwork[1]];
      v[hwork[0]] = v[hwork[0]] - v[hwork[1]];
    }

    for (int ii = 0; ii < v.length; ii++) {
      System.out.println(v[ii]);
    }
  }
}