#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
mt19937 rnd(time(nullptr));
const int N = 3e5 + 5;
pair<pair<int, int>, int> a[N];
int t[4 * N], p[4 * N];
void push(int v, int tl, int tr) {
  if (!p[v]) return;
  int vv = v << 1;
  int tm = tl + tr >> 1;
  p[vv] = p[vv + 1] = p[v];
  t[vv] = p[v] * (tm - tl + 1);
  t[vv + 1] = p[v] * (tr - tm);
  p[v] = 0;
}
void upd(int v, int tl, int tr, int l, int r, int val) {
  if (tl > r || l > tr) return;
  if (l <= tl && tr <= r) {
    t[v] = val * (tr - tl + 1);
    p[v] = val;
    return;
  }
  int vv = v << 1;
  int tm = tl + tr >> 1;
  push(v, tl, tr);
  upd(vv, tl, tm, l, r, val);
  upd(vv + 1, tm + 1, tr, l, r, val);
  t[v] = t[vv] + t[vv + 1];
}
int get(int v, int tl, int tr, int l, int r) {
  if (tl > r || l > tr) return 0;
  if (l <= tl && tr <= r) return t[v];
  int vv = v << 1;
  int tm = tl + tr >> 1;
  push(v, tl, tr);
  return get(vv, tl, tm, l, r) + get(vv + 1, tm + 1, tr, l, r);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; ++i)
    cin >> a[i].first.first >> a[i].first.second >> a[i].second;
  for (int i = m; i; --i) {
    int was = get(1, 1, n, a[i].second, a[i].second);
    upd(1, 1, n, a[i].first.first, a[i].first.second, a[i].second);
    upd(1, 1, n, a[i].second, a[i].second, was);
  }
  for (int i = 1; i <= n; ++i) cout << get(1, 1, n, i, i) << " ";
}
