#include <bits/stdc++.h>
using namespace std;
set<long> s;
long mapp[300100];
int main() {
  long n, m;
  cin >> n >> m;
  for (long i = 1; i <= n; i++) s.insert(i);
  long l, r, x;
  for (long i = 0; i < m; i++) {
    cin >> l >> r >> x;
    vector<long> v;
    for (set<long>::iterator f =
             ((s.find(l) != s.end()) ? s.find(l) : s.upper_bound(l));
         f != s.end(); f++) {
      if (*f != x && *f <= r && *f >= l) {
        mapp[*f] = x;
        v.push_back(*f);
      }
      if (*f >= r) break;
    }
    for (long i = 0; i < v.size(); i++) {
      s.erase(v[i]);
    }
  }
  for (long i = 1; i <= n; i++) {
    cout << mapp[i] << " ";
  }
  cout << endl;
  return 0;
}
