#include <bits/stdc++.h>
using namespace std;
int n, res[300011];
set<int> alive;
int main() {
  int m, lo, hi, winner;
  scanf("%d %d", &n, &m);
  for (int i = (1), _b = (n); i <= _b; i++) {
    alive.insert(i);
    res[i] = 0;
  }
  for (int i = 0, _n = (m); i < _n; i++) {
    scanf("%d %d %d", &lo, &hi, &winner);
    set<int>::iterator it = alive.lower_bound(lo);
    vector<int> v;
    while (it != alive.end()) {
      if (*it > hi) break;
      if (*it != winner) {
        res[*it] = winner;
        v.push_back(*it);
      }
      it++;
    }
    for (int j = 0, _n = (v.size()); j < _n; j++) alive.erase(v[j]);
  }
  for (int i = (1), _b = (n); i <= _b; i++) printf("%d ", res[i]);
  puts("");
  return 0;
}
