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