#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  set<int> nd;
  for (int i = 1; i <= n; i++) nd.insert(i);
  int par[n];
  for (int i = 0; i < m; i++) {
    set<int>::iterator b, e;
    int l, r, x1;
    scanf("%d %d %d", &l, &r, &x1);
    b = nd.lower_bound(l);
    e = nd.upper_bound(r);
    for (set<int>::iterator it = b; it != e; it++) {
      if (*it == x1) continue;
      par[*it - 1] = x1;
    }
    nd.erase(b, e);
    nd.insert(x1);
  }
  set<int>::iterator a = nd.begin();
  par[*a - 1] = 0;
  for (int i = 0; i < n; i++) printf("%d ", par[i]);
  printf("\n");
  return 0;
}
