#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  set<int> s;
  for (int i = 1; i <= n; i++) {
    s.insert(i);
  }
  int ans[n + 1];
  memset(ans, 0, sizeof(ans));
  ans[0] = -1;
  while (m--) {
    int l, r, x;
    cin >> l >> r >> x;
    auto it = s.lower_bound(l);
    vector<int> ers;
    while (it != s.end()) {
      if (*it > r) {
        break;
      }
      if (*it != x) {
        ers.push_back(*it);
        ans[*it] = x;
      }
      it++;
    }
    for (int i = 0; i < ers.size(); i++) {
      s.erase(ers[i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
