#include <bits/stdc++.h>
using namespace std;
set<int> s;
int ans[1000000];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int i, j, l, r, w;
  for (i = 1; i <= n; i++) s.insert(i);
  for (i = 0; i < m; i++) {
    scanf("%d %d %d", &l, &r, &w);
    auto idx1 = s.lower_bound(l);
    auto idx2 = s.upper_bound(r);
    vector<int> v;
    for (auto it = idx1; it != idx2; it++) {
      ans[*it] = w;
      if (*it != w) v.push_back(*it);
    }
    for (j = 0; j < v.size(); j++) s.erase(v[j]);
  }
  ans[w] = 0;
  for (i = 1; i <= n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
