#include <bits/stdc++.h>
using namespace std;
int n, m, ans[1020304];
int main() {
  cin >> n >> m;
  set<int> S;
  S.clear();
  for (int i = 1; i <= n; ++i) S.insert(i);
  for (int i = 1; i <= m; ++i) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    set<int>::iterator it = S.lower_bound(l), it2;
    while (it != S.end()) {
      if (*it > r) break;
      it2 = it;
      ++it;
      if (*it2 != x) ans[*it2] = x, S.erase(it2);
    }
  }
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}
