#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
signed main() {
  int n, q;
  cin >> n >> q;
  set<int> se;
  for (int i = 0; i < n; i++) se.insert(i);
  vector<int> ans(n);
  for (int i = 0; i < q; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    x--;
    l--;
    r--;
    auto it = se.lower_bound(l);
    while (it != se.end() && (*it) <= r) {
      int num = (*it);
      ans[num] = x;
      it++;
    }
    it = se.lower_bound(l);
    while (!se.empty() && it != se.end() && (*it) <= r) {
      se.erase(it);
      it = se.lower_bound(l);
    }
    se.insert(x);
  }
  for (int i = 0; i < n; i++) {
    if (ans[i] == i)
      cout << 0 << " ";
    else
      cout << ans[i] + 1 << " ";
  }
  return 0;
}
