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