#include <bits/stdc++.h>
int ans[300005], next[300005];
int getnext(int v) {
  if (next[v] == v) return v;
  return next[v] = getnext(next[v]);
}
int main() {
  int l, r, x;
  int n, m, i;
  int curt;
  scanf("%d%d", &n, &m);
  for (i = 0; i <= n + 1; i++) next[i] = i;
  for (i = 0; i < m; i++) {
    scanf("%d%d%d", &l, &r, &x);
    curt = getnext(l);
    while (curt <= r) {
      if (curt == x)
        curt++;
      else {
        ans[curt] = x;
        next[curt] = curt + 1;
      }
      curt = getnext(curt);
    }
  }
  for (i = 1; i <= n; i++) {
    if (i == 1)
      printf("%d", ans[i]);
    else
      printf(" %d", ans[i]);
  }
  printf("\n");
  return 0;
}
