#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  int m;
  cin >> n;
  cin >> m;
  vector<int32_t> res(n + 1);
  set<int> alive;
  for (int i = 1; i < n + 1; i++) {
    alive.insert(i);
  }
  for (int i = 0; i < m; i++) {
    int l;
    cin >> l;
    int r;
    cin >> r;
    int w;
    cin >> w;
    auto x = alive.lower_bound(l);
    auto y = alive.upper_bound(r);
    for (auto it = x; it != y;) {
      if (*it != w) {
        res[*it] = w;
        it = alive.erase(it);
      } else {
        it++;
      }
    }
  }
  for (int i = 1; i < n + 1; i++) {
    cout << res[i] << " ";
  }
  cout << endl;
  return 0;
}
