#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int main() {
  int n, m, l, r, x;
  cin >> n >> m;
  map<int, int> mm;
  for (int i = (0); i < (n); i++) mm[i + 1] = 1;
  vector<int> res(n + 1, 0);
  for (int i = (0); i < (m); i++) {
    cin >> l >> r >> x;
    map<int, int>::iterator itStart = mm.lower_bound(l);
    map<int, int>::iterator itEnd = mm.upper_bound(r);
    do {
      if (itStart->first != x && itStart->first <= r) {
        res[itStart->first] = x;
        map<int, int>::iterator it = itStart;
        itStart++;
        mm.erase(it->first);
      } else
        itStart++;
    } while (itStart != itEnd);
  }
  for (int i = (1); i < (n + 1); i++) cout << res[i] << " ";
  return 0;
}
