#include <bits/stdc++.h>
using namespace std;
int n, q, l, r, x, xx;
int St[4 * (int)(3e5 + 10)], Lazy[4 * (int)(3e5 + 10)];
pair<pair<int, int>, int> Q[(int)(3e5 + 10)];
void push(int v, int sol, int sag) {
  St[sol] = Lazy[v];
  St[sag] = Lazy[v];
  Lazy[sol] = Lazy[v];
  Lazy[sag] = Lazy[v];
  Lazy[v] = -1;
}
void upd(int v, int sol, int sag, int l, int r, int x) {
  if (sol > r or sag < l) return;
  if (l <= sol and sag <= r) {
    St[v] = x;
    Lazy[v] = x;
    return;
  }
  if (Lazy[v] != -1) push(v, 2 * v, 2 * v + 1);
  upd(2 * v, sol, ((sol + sag) / 2), l, r, x);
  upd(2 * v + 1, ((sol + sag) / 2) + 1, sag, l, r, x);
}
int que(int v, int sol, int sag, int x) {
  if (sol > x or sag < x) return 0;
  if (sol == sag) return St[v];
  if (Lazy[v] != -1) push(v, 2 * v, 2 * v + 1);
  return que(2 * v, sol, ((sol + sag) / 2), x) +
         que(2 * v + 1, ((sol + sag) / 2) + 1, sag, x);
}
int main() {
  memset(Lazy, -1, sizeof Lazy);
  cin >> n >> q;
  for (int i = 1; i <= q; i++) {
    scanf("%d %d %d", &l, &r, &x);
    Q[i] = make_pair(make_pair(l, r), x);
  }
  for (int i = q; i >= 1; i--) {
    l = Q[i].first.first;
    r = Q[i].first.second;
    x = Q[i].second;
    xx = que(1, 1, n, x);
    upd(1, 1, n, l, r, x);
    upd(1, 1, n, x, x, xx);
  }
  for (int i = 1; i <= n; i++) printf("%d ", que(1, 1, n, i));
}
