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