#include <bits/stdc++.h>
using namespace std;
int n, m;
int x, y, w;
int win[300005];
set<int> q;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) q.insert(i);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &x, &y, &w);
    set<int>::iterator l, r, t;
    l = q.lower_bound(x);
    r = q.lower_bound(y);
    t = l;
    while (t != r)
      if (*t != w)
        win[*(t++)] = w;
      else
        t++;
    if (r != q.end() && *r != w && *r == y) win[*r] = w;
    q.erase(l, r);
    if (r != q.end() && *r == y) q.erase(r);
    q.insert(w);
  }
  for (int i = 1; i < n; i++) printf("%d ", win[i]);
  printf("%d\n", win[n]);
  return 0;
}
