#include <bits/stdc++.h>
using namespace std;
set<int> se;
int mark[300000 + 10];
set<int>::iterator it;
int main() {
  int n, m, a, b, c;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) se.insert(i);
  it = se.begin();
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &a, &b, &c);
    it = se.lower_bound(a);
    while (it != se.end() && (*it) <= b) {
      mark[*it] = c;
      se.erase(it++);
    }
    se.insert(c);
  }
  for (int i = 1; i <= n; ++i) {
    if (i == mark[i])
      printf("0 ");
    else
      printf("%d ", mark[i]);
  }
  puts("");
  return 0;
}
