#include <bits/stdc++.h>
using namespace std;
vector<int> tree;
vector<int> res;
void update(int v, int tl, int tr, int l, int r, int k) {
  if (l > r) return;
  if (tree[v] != 0) {
    if (res[tree[v]] == 0 && tree[v] != k) res[tree[v]] = k;
    return;
  }
  if (tl == l && tr == r) {
    tree[v] = k;
    if (tl == tr && k != tl) res[tl] = k;
  }
  if (tl != tr) {
    int tm = (tl + tr) / 2;
    update(2 * v, tl, tm, l, min(r, tm), k);
    update(2 * v + 1, tm + 1, tr, max(l, tm + 1), r, k);
  }
}
int main() {
  long long n, m;
  cin >> n >> m;
  tree.resize(4 * n, 0);
  res.resize(n + 1, 0);
  for (long long i = 0; i < m; i++) {
    long long l, r, k;
    cin >> l >> r >> k;
    update(1, 1, n, l, r, k);
  }
  for (int i = 1; i < res.size(); i++) {
    cout << res[i] << ' ';
  }
  cout << endl;
  return 0;
}
