#include <bits/stdc++.h>
using namespace std;
const int N = 1000100;
struct tree {
  int val, color;
  tree() {
    val = 0;
    color = -1;
  }
} t[4 * N];
int n, m;
int l[N], r[N], x[N], ans[N];
void push(int v, int tl, int tr) {
  if (t[v].color == -1) {
    return;
  }
  t[v].val = t[v].color;
  t[v * 2].color = t[v * 2 + 1].color = t[v].color;
  t[v].color = -1;
}
void update(int v, int tl, int tr, int l, int r, int val) {
  if (l > tr || r < tl) {
    return;
  }
  push(v, tl, tr);
  if (l <= tl && tr <= r) {
    t[v].color = val;
    push(v, tl, tr);
  } else {
    int tm = (tl + tr) / 2;
    update(v * 2, tl, tm, l, r, val);
    update(v * 2 + 1, tm + 1, tr, l, r, val);
  }
}
void get(int v, int tl, int tr) {
  if (tl > tr) {
    return;
  }
  push(v, tl, tr);
  if (tl == tr) {
    ans[tl] = t[v].val;
  } else {
    int tm = (tl + tr) / 2;
    get(v * 2, tl, tm);
    get(v * 2 + 1, tm + 1, tr);
  }
}
int main() {
  scanf("%d %d", &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--) {
    update(1, 1, n, l[i], x[i] - 1, x[i]);
    update(1, 1, n, x[i] + 1, r[i], x[i]);
  }
  get(1, 1, n);
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
