#include <bits/stdc++.h>
int pre[300009], a[300009];
int find(int x) {
  if (pre[x] != x) pre[x] = find(pre[x]);
  return pre[x];
}
void solve(int l, int r, int x) {
  while (l <= r) {
    if (find(l) == l) {
      a[l] = x;
      pre[l] = l + 1;
    }
    l = pre[l];
  }
}
int main() {
  int n, m, l, r, x;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n + 1; i++) pre[i] = i, a[i] = 0;
  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    solve(l, x - 1, x);
    solve(x + 1, r, x);
  }
  for (int i = 1; i <= n - 1; i++) printf("%d ", a[i]);
  printf("%d\n", a[n]);
  return 0;
}
