#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long cl(double a) {
  if (a > (long long)a) {
    return (long long)a + 1;
  } else {
    return (long long)a;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  set<long long> s;
  for (long long i = 0; i < n; i++) s.insert(i + 1);
  unordered_map<long long, long long> par;
  for (long long i = 0; i < m; i++) {
    long long l, r, x;
    cin >> l >> r >> x;
    vector<long long> td;
    auto it = s.lower_bound(l);
    while (it != s.end()) {
      long long curr = *it;
      if (curr > r) break;
      if (curr != x) {
        par[curr] = x;
        td.push_back(curr);
      }
      it++;
    }
    for (long long j = 0; j < td.size(); j++) {
      s.erase(td[j]);
    }
  }
  for (long long i = 0; i < n; i++) cout << par[i + 1] << " ";
  cout << "\n";
}
