#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.precision(10), cout << fixed;
  int n, m;
  cin >> n >> m;
  set<int> knights;
  vector<int> ans(n);
  for (int i = 1; i <= n; ++i) knights.insert(i);
  int l, r, x;
  while (m--) {
    stack<int> s;
    cin >> l >> r >> x;
    auto L = knights.lower_bound(l);
    auto R = knights.end();
    while (L != knights.end()) {
      if (*L > r) break;
      if (*L != x) {
        ans[*L - 1] = x;
        s.push(*L);
      }
      L++;
    }
    while (!s.empty()) {
      knights.erase(s.top());
      s.pop();
    }
  }
  for (auto i : ans) cout << i << " ";
  cout << '\n';
  return 0;
}
