#include <bits/stdc++.h>
using namespace std;
int ans[300005];
void input() {
  int i, l, r, x, cur, n, ne;
  set<int> alive;
  set<int>::iterator ite;
  vector<int> xoa;
  scanf("%d %d", &n, &ne);
  for ((i) = (1); (i) <= (n); (i)++) alive.insert(i);
  for ((i) = 0; (i) < (ne); (i)++) {
    scanf("%d %d %d", &l, &r, &x);
    xoa.clear();
    ite = alive.lower_bound(l);
    while (ite != alive.end()) {
      cur = *ite;
      if (cur > r) break;
      if (cur != x) ans[cur] = x, xoa.push_back(cur);
      ite++;
    }
    for (typeof(xoa.begin()) jte = xoa.begin(); jte != xoa.end(); jte++)
      alive.erase(*jte);
  }
  for ((i) = (1); (i) <= (n); (i)++) printf("%d ", ans[i]);
}
int main() {
  input();
  return 0;
}
