#include <bits/stdc++.h>
using namespace std;
set<int> v;
int num[300005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int l, r, x;
  memset(num, 0, sizeof(num));
  for (int i = 1; i <= n; i++) {
    v.insert(i);
  }
  set<int>::iterator it, s;
  bool flag = true;
  for (int i = 0; i < m; i++) {
    flag = true;
    scanf("%d%d%d", &l, &r, &x);
    it = v.upper_bound(l - 1);
    s = it;
    while (it != v.end() && (*it) <= r) {
      flag = false;
      num[*it] = x;
      it++;
    }
    v.erase(s, it);
    if (!flag) v.insert(x);
  }
  num[x] = 0;
  printf("%d", num[1]);
  for (int i = 2; i <= n; i++) printf(" %d", num[i]);
  printf("\n");
  return 0;
}
