#include <bits/stdc++.h>
using namespace std;
const int mn = 3e5 + 1;
int n, m, d[mn], tree[4 * mn], k;
struct queri {
  int l, r, x;
} a[mn];
void update(int l, int r, int x, int y, int id, int val) {
  if (r < x || l > y) return;
  if (x <= l && r <= y) {
    tree[id] = val;
    return;
  }
  int mid = (l + r) / 2;
  update(l, mid, x, y, id * 2, val);
  update(mid + 1, r, x, y, id * 2 + 1, val);
}
void get(int l, int r, int x, int id) {
  if (!(l <= x && x <= r)) return;
  k = max(k, tree[id]);
  if (l == r) return;
  int mid = (l + r) / 2;
  get(l, mid, x, id * 2);
  get(mid + 1, r, x, id * 2 + 1);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> a[i].l >> a[i].r >> a[i].x;
    d[m - i + 1] = a[i].x;
  }
  for (int i = m; i >= 1; --i) {
    if (a[i].l <= a[i].x - 1) update(1, n, a[i].l, a[i].x - 1, 1, m - i + 1);
    if (a[i].r >= a[i].x + 1) update(1, n, a[i].x + 1, a[i].r, 1, m - i + 1);
  }
  for (int i = 1; i <= n; ++i) {
    k = 0, get(1, n, i, 1);
    cout << d[k] << " ";
  }
  return 0;
}
