#include <bits/stdc++.h>
using namespace std;
long long fast_pow(long long base, long long n, long long M) {
  if (n == 0) return 1;
  if (n == 1) return base;
  long long halfn = fast_pow(base, n / 2, M);
  if (n % 2 == 0)
    return (halfn * halfn) % M;
  else
    return (((halfn * halfn) % M) * base) % M;
}
void quickly_quickly_kro() {
  long long n, m;
  cin >> n >> m;
  set<long long> s;
  for (long long i = 1; i < n + 1; i++) s.insert(i);
  vector<long long> v(n + 1);
  for (long long t = 0; t < m; t++) {
    long long l, r, x;
    cin >> l >> r >> x;
    auto it = s.lower_bound(l);
    vector<long long> remo;
    while (*it <= r && it != s.end()) {
      if (*it != x) {
        v[*it] = x;
        remo.push_back(*it);
      }
      it++;
    }
    for (long long i = 0; i < (long long)((remo).size()); i++) {
      auto it = s.find(remo[i]);
      s.erase(it);
    }
  }
  for (long long i = 1; i < n + 1; i++) cout << v[i] << " ";
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    quickly_quickly_kro();
    cout << "\n";
    ;
  }
  return 0;
}
