#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, m;
int ans[N];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  set<int> alive;
  for (int i = 1; i <= n; i++) alive.insert(i);
  while (m--) {
    int l, r, x;
    cin >> l >> r >> x;
    auto it = alive.lower_bound(l);
    vector<int> dead;
    while (it != alive.end()) {
      int cur = *it;
      if (cur > r) break;
      dead.push_back(cur);
      it++;
    }
    for (auto &k : dead) {
      if (k != x) {
        ans[k] = x;
        alive.erase(k);
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
