#include <bits/stdc++.h>
using namespace std;
int ans[300001];
int segtree[5000000];
int l[300001], r[300001], x[300001];
void find_ans(int i, int start, int end, int val) {
  if (!segtree[i]) segtree[i] = val;
  if (start == end) {
    ans[start] = segtree[i];
    return;
  }
  int mid = start + (end - start) / 2;
  find_ans(2 * i + 1, start, mid, segtree[i]);
  find_ans(2 * i + 2, mid + 1, end, segtree[i]);
}
void filltree(int st, int en, int val, int pos, int start, int end) {
  if (st > en) return;
  if (st <= start and en >= end) {
    if (!segtree[pos]) segtree[pos] = val;
    return;
  }
  if (st > end or en < start) return;
  if (!segtree[2 * pos + 1]) segtree[2 * pos + 1] = segtree[pos];
  if (!segtree[2 * pos + 2]) segtree[2 * pos + 2] = segtree[pos];
  int mid = start + (end - start) / 2;
  filltree(st, en, val, 2 * pos + 1, start, mid);
  filltree(st, en, val, 2 * pos + 2, mid + 1, end);
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> l[i] >> r[i] >> x[i];
  }
  for (int i = 1; i <= m; i++) {
    filltree(l[i], x[i] - 1, x[i], 0, 1, n);
    filltree(x[i] + 1, r[i], x[i], 0, 1, n);
  }
  find_ans(0, 1, n, 0);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
