#include <bits/stdc++.h>
using namespace std;
set<int> s;
int res[500000];
int main() {
  int n, m;
  int u, v, w;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    s.insert(i);
    res[i];
  }
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &u, &v, &w);
    set<int>::iterator itlow = s.lower_bound(u);
    set<int>::iterator itup = s.upper_bound(v);
    if (itup == s.end()) {
      for (set<int>::iterator it = itlow; it != s.end(); ++it) {
        if (w != *it) {
          res[*it] = w;
        }
      }
      --itup;
      s.erase(itlow, s.end());
    } else {
      for (set<int>::iterator it = itlow; it != itup; ++it) {
        if (w != *it) {
          res[*it] = w;
        }
      }
      s.erase(itlow, itup);
    }
    s.insert(w);
    if (i == m - 1) {
      res[w] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d%c", res[i], i == n ? '\n' : ' ');
  }
}
