#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  set<int> s;
  for (int i = 1; i <= n; ++i) {
    s.insert(i);
  }
  vector<int> ans(n + 2);
  while (m--) {
    int l, r, k;
    cin >> l >> r >> k;
    auto it = s.lower_bound(l);
    while (it != s.end() && *it <= r) {
      if (*it != k) {
        ans[*it] = k;
        int prev = *it;
        it++;
        s.erase(prev);
      } else
        it++;
      if (s.size() == 1) break;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << ' ';
  }
  return 0;
}
