#include <bits/stdc++.h>
using namespace std;
long long st[4 * 1000005 + 10], ans[1000005];
void update(long long second, long long se, long long qs, long long qe,
            long long si, long long x) {
  if (second >= qs && se <= qe) {
    if (st[si] == 0) st[si] = x;
    return;
  }
  long long mid = (second + se) / 2;
  if (mid >= qs && st[2 * si] == 0) update(second, mid, qs, qe, 2 * si, x);
  if (mid + 1 <= qe && st[(2 * si) + 1] == 0)
    update(mid + 1, se, qs, qe, (2 * si) + 1, x);
}
void query(long long second, long long se, long long qq, long long si) {
  if (st[si] != 0) {
    if (second != se) {
      if (st[2 * si] == 0) st[2 * si] = st[si];
      if (st[(2 * si) + 1] == 0) st[(2 * si) + 1] = st[si];
      st[si] = 0;
    }
  }
  if (second == se) {
    ans[qq] = st[si];
    return;
  }
  long long mid = (second + se) / 2;
  if (qq <= mid) query(second, mid, qq, 2 * si);
  if (qq > mid) query(mid + 1, se, qq, (2 * si) + 1);
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  memset(st, 0, sizeof(st));
  while (m--) {
    long long l, r, x;
    cin >> l >> r >> x;
    if (x - 1 >= l) update(1, n, l, x - 1, 1, x);
    if (x + 1 <= r) update(1, n, x + 1, r, 1, x);
  }
  for (long long int i = 1; i <= n; i++) query(1, n, i, 1);
  for (long long int i = 1; i <= n; i++) cout << ans[i] << " ";
}
