#include <bits/stdc++.h>
using namespace std;
int v[300005];
set<int> s;
int n, m, x, l, r;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) s.insert(i);
  for (int i = 1; i <= m; i++) {
    cin >> l >> r >> x;
    set<int>::iterator it;
    it = s.lower_bound(l);
    vector<int> lol;
    while (it != s.end()) {
      int aux = *it;
      if (aux > r) break;
      if (aux != x) {
        lol.push_back(aux);
        v[aux] = x;
      }
      it++;
    }
    for (int j = 0; j < lol.size(); j++) s.erase(lol[j]);
  }
  for (int i = 1; i <= n; i++) cout << v[i] << " ";
  return 0;
}
