#include <bits/stdc++.h>
using namespace std;
const int N = 300002;
set<int> knights;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) knights.insert(i);
  int ans[N];
  memset(ans, 0, sizeof(ans));
  vector<int> tmp;
  while (m-- > 0) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    tmp.clear();
    set<int>::iterator it = knights.lower_bound(l);
    while (it != knights.end() && (*it) <= r) {
      if ((*it) != x) {
        ans[*it] = x;
        tmp.push_back(*it);
      }
      it++;
    }
    for (int i = 0; i < tmp.size(); i++) knights.erase(knights.find(tmp[i]));
  }
  printf("%d", ans[1]);
  for (int i = 2; i <= n; i++) printf(" %d", ans[i]);
  puts("");
  return 0;
}
