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