#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, a, b, c;
  cin >> n >> m;
  vector<int> ans(n, 0);
  set<int> s;
  for (int i = 1; i <= n; ++i) {
    s.insert(i);
  }
  while (m--) {
    cin >> a >> b >> c;
    auto lt = s.lower_bound(a), ht = prev(s.upper_bound(b));
    auto ct = lt;
    while (ct != next(ht)) {
      if (*ct != c) {
        ans[*ct - 1] = c;
      }
      ct = next(ct);
    }
    s.erase(lt, next(ht));
    s.insert(c);
  }
  for (int x : ans) cout << x << " ";
}
