#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 10;
int n, seg[4 * N], x, y, val, ans[N], m;
void update(int p, int l, int r, int st, int en, int val) {
  if (st > r || en < l) return;
  if (seg[p] == 1) return;
  if (l == r) {
    ans[l] = val;
    seg[p] = 1;
    return;
  }
  int mid = (l + r) / 2;
  update(2 * p, l, mid, st, en, val);
  update(2 * p + 1, mid + 1, r, st, en, val);
  seg[p] = seg[2 * p + 1] & seg[2 * p];
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> val;
    update(1, 1, n, x, val - 1, val);
    if (val + 1 <= y) update(1, 1, n, val + 1, y, val);
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
