#include <bits/stdc++.h>
using namespace std;
set<int> s;
int a[300000 + 10];
int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    s.clear();
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= n; ++i) s.insert(i);
    int li, ri, xi;
    set<int>::iterator it, beg, end;
    vector<set<int>::iterator> t;
    vector<set<int>::iterator>::iterator vit;
    while (m--) {
      scanf("%d %d %d", &li, &ri, &xi);
      beg = s.lower_bound(li), end = s.upper_bound(ri);
      for (it = beg; it != end; ++it)
        if (*it != xi) {
          a[*it] = xi;
          t.push_back(it);
        }
      for (vit = t.begin(); vit != t.end(); ++vit) s.erase(*vit);
      t.clear();
    }
    for (int i = 1; i <= n; ++i) printf(i == n ? "%d\n" : "%d ", a[i]);
  }
  return 0;
}
