#include <bits/stdc++.h>
const long long maxn = 1e6 + 5;
const long long mod = 1e9 + 7;
const long long base = 1331;
using namespace std;
set<long long> v, nv;
long long n, m;
long long ans[maxn];
void read(void) {
  cin >> n >> m;
  for (long long i = 1; i <= (long long)(n); ++i) v.insert(i);
  while (m--) {
    long long l, r, k;
    cin >> l >> r >> k;
    auto i = v.lower_bound(l);
    auto j = v.upper_bound(r);
    for (auto it = i; it != j; it++) {
      if (*it != k) {
        ans[*it] = k;
        nv.insert(*it);
      }
    }
    for (auto &x : nv) {
      v.erase(x);
    }
    nv.clear();
  }
  for (long long i = 1; i <= (long long)(n); ++i) cout << ans[i] << ' ';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(0);
  read();
}
