#include <bits/stdc++.h>
using namespace std;
set<int> s;
set<int>::iterator it, itt;
int n, m;
int a[300005];
int l, r, x;
int main() {
  scanf("%d %d", &n, &m);
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++) s.insert(i);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &l, &r, &x);
    it = s.lower_bound(l);
    for (; (*it) <= r && it != s.end(); it = itt) {
      a[*it] = x;
      itt = it;
      itt++;
      s.erase(*it);
    }
    s.insert(x);
    a[x] = 0;
  }
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
