#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  set<long long> s;
  vector<long long> ar(n + 1, 0);
  for (long long i = 0; i < n; i++) {
    s.insert(i + 1);
  }
  for (long long i = 1; i <= m; i++) {
    long long li, ri, xi;
    vector<long long> temp;
    cin >> li >> ri >> xi;
    auto itl = s.lower_bound(li);
    auto itr = s.upper_bound(ri);
    for (auto it = itl; it != itr && (*it) <= ri; it++) temp.push_back(*it);
    for (auto i : temp) {
      if (i != xi) {
        s.erase(i);
        ar[i] = xi;
      }
    }
  }
  for (long long i = 1; i <= n; i++) cout << ar[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) solve();
  return 0;
}
