#include <bits/stdc++.h>
using namespace std;
struct query {
  int l, r;
};
struct query q[300005];
set<int> st;
int ans[300005], n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) st.insert(i);
  for (int i = 0; i < m; i++) {
    int x, l, r;
    cin >> l >> r >> x;
    auto its = st.lower_bound(l);
    auto ite = st.lower_bound(r);
    if (*(ite) > r || ite == st.end()) ite--;
    for (auto it = its;; it++) {
      ans[*(it)] = x;
      if (it == ite) break;
    }
    ite++;
    st.erase(its, ite);
    st.insert(x);
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i] != i)
      cout << ans[i] << ' ';
    else
      cout << 0 << ' ';
  }
  cout << '\n';
  return 0;
}
