#include <bits/stdc++.h>
const int maxn = 300003;
int t[maxn << 2];
int a[maxn];
void kill(int v, int l, int r, int L, int R, int q) {
  if (L > R || t[v]) return;
  if (L == l && R == r) {
    t[v] = q;
    return;
  }
  int m = (l + r) >> 1;
  if (m >= R)
    kill(v << 1, l, m, L, R, q);
  else if (m < L)
    kill(v << 1 | 1, m + 1, r, L, R, q);
  else {
    kill(v << 1, l, m, L, m, q);
    kill(v << 1 | 1, m + 1, r, m + 1, R, q);
  }
}
void build(int v, int l, int r) {
  if (l == r) {
    a[l] = t[v];
    return;
  }
  int m = (l + r) >> 1;
  kill(v << 1, l, m, l, m, t[v]);
  kill(v << 1 | 1, m + 1, r, m + 1, r, t[v]);
  t[v] = 0;
  build(v << 1, l, m);
  build(v << 1 | 1, m + 1, r);
}
int main() {
  int n, m, l, r, q;
  scanf("%d %d", &n, &m);
  while (m--) {
    scanf("%d %d %d", &l, &r, &q);
    kill(1, 1, n, l, q - 1, q);
    kill(1, 1, n, q + 1, r, q);
  }
  build(1, 1, n);
  for (int i = 1; i <= n; i++) printf("%d%c", a[i], " \n"[i == n]);
  return 0;
}
