#include <bits/stdc++.h>
using namespace std;
int seg[4 * 300005];
int a[300005];
int n, m;
void update(int i, int l, int r, int ll, int rr, int x) {
  if (l > rr || r < ll) return;
  if (seg[i] != 0) return;
  if ((x < l || x > r) && ll <= l && r <= rr) {
    seg[i] = x;
    return;
  }
  if (l == r) return;
  int mid = (l + r) / 2;
  update(2 * i, l, mid, ll, rr, x);
  update(2 * i + 1, mid + 1, r, ll, rr, x);
}
void push_all(int i, int l, int r) {
  if (l == r) {
    a[l] = seg[i];
    return;
  }
  if (seg[i] != 0) {
    if (seg[2 * i] == 0) seg[2 * i] = seg[i];
    if (seg[2 * i + 1] == 0) seg[2 * i + 1] = seg[i];
  }
  int mid = (l + r) / 2;
  push_all(2 * i, l, mid);
  push_all(2 * i + 1, mid + 1, r);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    update(1, 1, n, l, r, x);
  }
  push_all(1, 1, n);
  for (int i = 1; i <= n; ++i) printf("%d ", a[i]);
  return 0;
}
