#include <bits/stdc++.h>
using namespace std;
int ans[900000], seg[2000009], n, m;
void build(int p, int l, int r) {
  if (p >= 2000000) return;
  if (r < l) return;
  seg[p] = r - l + 1;
  int md = (l + r) / 2;
  build(2 * p, l, md);
  build(2 * p + 1, md + 1, r);
}
int cha(int p, int q, int l, int r, int e, int o) {
  if (o < l || r < e) {
    return 0;
  }
  if (l == r) {
    if (ans[l] == -1 && l != q) {
      ans[l] = q;
      return seg[p] = 0;
    } else if (ans[l] == -1) {
      return seg[p] = 1;
    } else
      return seg[p] = 0;
  }
  if (seg[p] == 0) {
    return 0;
  }
  int md = (l + r) / 2;
  cha(2 * p, q, l, md, e, o);
  cha(2 * p + 1, q, md + 1, r, e, o);
  return seg[p] = seg[2 * p] + seg[2 * p + 1];
}
int main() {
  cin >> n >> m;
  memset(ans, -1, sizeof(ans));
  build(1, 1, n);
  for (int i = 0; i < m; i++) {
    int l, r, q;
    cin >> l >> r >> q;
    cha(1, q, 1, n, l, r);
  }
  for (int i = 1; i <= n; i++)
    if (ans[i] != -1)
      cout << ans[i] << " ";
    else
      cout << 0 << " ";
  return 0;
}
