#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
struct Node {
  int cov, l, r;
} nodes[N * 4];
int n, m;
int l[N], r[N], x[N];
void build(int rt, int l, int r) {
  nodes[rt].l = l, nodes[rt].r = r, nodes[rt].cov = 0;
  if (l == r) {
    return;
  }
  build((rt << 1), l, ((l + r) >> 1));
  build(((rt << 1) | 1), ((l + r) >> 1) + 1, r);
}
void update(int rt, int L, int R, int cov) {
  if (L > R) return;
  int l = nodes[rt].l, r = nodes[rt].r;
  if (L <= l && r <= R) {
    nodes[rt].cov = cov;
    return;
  }
  if (nodes[rt].cov != 0) {
    nodes[(rt << 1)].cov = nodes[((rt << 1) | 1)].cov = nodes[rt].cov;
    nodes[rt].cov = 0;
  }
  if (L <= ((l + r) >> 1)) update((rt << 1), L, R, cov);
  if (R > ((l + r) >> 1)) update(((rt << 1) | 1), L, R, cov);
}
int query(int rt, int index) {
  int l = nodes[rt].l, r = nodes[rt].r;
  if (l == r) {
    return nodes[rt].cov;
  }
  if (nodes[rt].cov != 0) {
    nodes[(rt << 1)].cov = nodes[((rt << 1) | 1)].cov = nodes[rt].cov;
    nodes[rt].cov = 0;
  }
  if (index > ((l + r) >> 1))
    return query(((rt << 1) | 1), index);
  else
    return query((rt << 1), index);
}
int main() {
  while (cin >> n >> m) {
    build(1, 1, n);
    for (int i = 0; i < m; i++) {
      cin >> l[i] >> r[i] >> x[i];
    }
    for (int i = m - 1; i >= 0; i--) {
      update(1, l[i], x[i] - 1, x[i]);
      update(1, x[i] + 1, r[i], x[i]);
    }
    int t;
    for (int i = 1; i < n; i++) {
      t = query(1, i);
      cout << t << " ";
    }
    t = query(1, n);
    cout << t << endl;
  }
  return 0;
}
