#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> ans(n + 1, -1);
  set<int> active;
  for (int i = 1; i <= n; ++i) {
    active.insert(i);
  }
  cout << '\n';
  for (int i = 0; i < m; ++i) {
    int l, r, x;
    cin >> l >> r >> x;
    auto it = active.lower_bound(l);
    auto it2 = active.lower_bound(r);
    if (*it2 == r) {
      it2++;
    }
    vector<int> eraser;
    for (auto pp = it; pp != it2; ++pp) {
      if (pp == active.end()) {
        break;
      }
      if (*pp != x) {
        ans[*pp] = x;
        eraser.push_back(*pp);
      }
    }
    for (auto oo : eraser) {
      active.erase(active.find(oo));
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (ans[i] == -1) {
      ans[i] = 0;
    }
    cout << ans[i] << " ";
  }
  cout << '\n';
  return 0;
}
