#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
int n, t[4 * 300500], m, l[300500], r[300500], x[300500];
void push(int v) {
  if (t[v] != -1) {
    t[v * 2] = t[v * 2 + 1] = t[v];
    t[v] = -1;
  }
}
void update(int v, int tl, int tr, int l, int r, int color) {
  if (l > r) return;
  if (l == tl && tr == r)
    t[v] = color;
  else {
    push(v);
    int tm = (tl + tr) / 2;
    update(v * 2, tl, tm, l, min(r, tm), color);
    update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, color);
  }
}
int get(int v, int tl, int tr, int pos) {
  if (tl == tr) return t[v];
  push(v);
  int tm = (tl + tr) / 2;
  if (pos <= tm)
    return get(v * 2, tl, tm, pos);
  else
    return get(v * 2 + 1, tm + 1, tr, pos);
}
void solve(int l, int r, int x, int i) {
  l--;
  r--;
  x--;
  update(1, 0, n - 1, l, x - 1, x + 1);
  update(1, 0, n - 1, x + 1, r, x + 1);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", l + i, r + i, x + i);
  }
  for (int i = m - 1; i >= 0; i--) {
    solve(l[i], r[i], x[i], i);
  }
  for (int i = 0; i < n; i++) cout << get(1, 0, n - 1, i) << " ";
  return 0;
}
