#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<int> res(n + 1), ans(n + 1);
  set<int> s;
  for (int i = 1; i <= n; ++i) s.insert(i);
  while (m--) {
    vector<int> erase;
    int l, r, x;
    cin >> l >> r >> x;
    auto it = s.lower_bound(l);
    while (it != s.end() && *it <= r) {
      if (*it != x) erase.emplace_back(*it), ans[*it] = x;
      ++it;
    }
    for (int i : erase) s.erase(i);
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
}
