#include <bits/stdc++.h>
int res[1100002];
int mark[1100002];
void set(int i, int L, int R, int l, int r, int x) {
  int LR, RL;
  if (L <= R && l <= r && L <= l && r <= R && res[i] <= 0 && mark[i] == 0) {
    if (L == l && R == r) mark[i] = 1;
    if (res[i] == 0 && L == l && R == r)
      res[i] = x;
    else {
      if (res[i] >= 0) {
        res[(i << 1) + 1] = res[i];
        res[(i << 1) + 2] = res[i];
        res[i] = -1;
        mark[(i << 1) + 1] = 0;
        mark[(i << 1) + 2] = 0;
      }
      LR = L + ((R - L) >> 1);
      RL = LR + 1;
      if (l <= LR) {
        if (r < LR)
          set((i << 1) + 1, L, LR, l, r, x);
        else
          set((i << 1) + 1, L, LR, l, LR, x);
      }
      if (r >= RL) {
        if (l > RL)
          set((i << 1) + 2, RL, R, l, r, x);
        else
          set((i << 1) + 2, RL, R, RL, r, x);
      }
    }
  }
}
void out(int i, int L, int R) {
  int j;
  if (res[i] >= 0)
    for (j = L; j <= R; j++) printf("%d ", res[i]);
  else {
    out((i << 1) + 1, L, L + ((R - L) >> 1));
    out((i << 1) + 2, L + ((R - L) >> 1) + 1, R);
  }
}
int main() {
  int i;
  int n;
  int m;
  int l, r, x;
  scanf("%d%d", &n, &m);
  res[0] = 0;
  mark[0] = 0;
  for (i = 0; i < m; i++) {
    scanf("%d%d%d", &l, &r, &x);
    if (x - 1 >= l) set(0, 1, n, l, x - 1, x);
    if (x + 1 <= r) set(0, 1, n, x + 1, r, x);
  }
  out(0, 1, n);
  return 0;
}
