#include <bits/stdc++.h>
using namespace std;
const int N = 300004;
set<int> st;
int a[N];
int main() {
  int n, m, x, y, d;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) st.insert(i);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &x, &y, &d);
    for (;;) {
      auto it = st.lower_bound(x);
      if (it == st.end() || (*it) > y) break;
      a[*it] = d;
      st.erase(it);
    }
    st.insert(d);
  }
  a[d] = 0;
  for (int i = 1; i <= n; i++) printf("%d%c", a[i], " \n"[i == n]);
}
