#include <bits/stdc++.h>
using namespace std;
vector<int> _p;
int p(int v) { return _p[v] == v ? v : _p[v] = p(_p[v]); }
void unite(int a, int b) { _p[a] = b; }
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  _p.resize(n + 2);
  vector<int> ans(n + 1);
  for (int i = 0; i <= n + 1; i++) {
    _p[i] = i;
  }
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    int cur = l;
    while ((cur = p(cur)) <= r) {
      if (cur != x) {
        ans[cur] = x;
        unite(cur, cur + 1);
      }
      cur++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << ' ';
  }
  return 0;
}
