#include <bits/stdc++.h>
using namespace std;
int n, m;
int l[1000001], r[1000001], x[1000001];
int sol[1000001];
set<int> bst;
set<int>::iterator it;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) bst.insert(i);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &l[i], &r[i], &x[i]);
    l[i]--;
    r[i]--;
    x[i]--;
    it = bst.lower_bound(l[i]);
    for (; it != bst.end() && (*it) <= r[i]; ++it) {
      sol[(*it)] = x[i];
    }
    bst.erase(bst.lower_bound(l[i]), bst.upper_bound(r[i]));
    bst.insert(x[i]);
  }
  for (int i = 0; i < n; i++) {
    if (sol[i] == i)
      printf("0 ");
    else
      printf("%d ", sol[i] + 1);
  }
  printf("\n");
  return 0;
}
