#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  set<int> S;
  for (int i = 1; i <= n; i++) {
    S.insert(i);
  }
  vector<int> a(n + 1, 0);
  while (m--) {
    int l, r, x;
    scanf("%d %d %d", &l, &r, &x);
    auto li = S.lower_bound(l);
    auto ri = S.upper_bound(r);
    set<int> flush;
    for (auto i = li; i != ri; i++) {
      int t = *i;
      if (t != x) {
        a[t] = x;
        flush.insert(t);
      }
    }
    for (auto e : flush) {
      S.erase(S.find(e));
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i]);
  }
  return 0;
}
