#include <bits/stdc++.h>
using namespace std;
set<int> a;
set<int>::iterator itl, itr, it;
int as[300010];
int main() {
  int i, j, n, m, l, r, x;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) a.insert(i);
  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    itl = a.lower_bound(l);
    itr = a.upper_bound(r);
    for (; itl != itr; itl++) {
      if ((*itl) == x) continue;
      as[(*itl)] = x;
    }
    while (1) {
      itl = a.lower_bound(l);
      if ((*itl) == x) break;
      a.erase(itl);
    }
    while (1) {
      itl = a.lower_bound(x + 1);
      if (itl == itr) break;
      a.erase(itl);
    }
  }
  for (i = 1; i <= n; i++) printf("%d ", as[i]);
  return 0;
}
