#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  int ans[n + 1];
  set<int> knights;
  for (int i = 1; i < n + 1; i++) {
    knights.insert(i);
  }
  knights.insert(INT_MAX);
  int l, r, x;
  vector<set<int>::iterator> deleted;
  for (int j = 0; j < m; j++) {
    cin >> l >> r >> x;
    set<int>::iterator it = knights.lower_bound(l);
    while ((*it) <= r) {
      if ((*it) != x) {
        ans[(*it)] = x;
        deleted.push_back(it);
      }
      it++;
    }
    for (int i = 0; i < deleted.size(); i++) {
      knights.erase(deleted[i]);
    }
    deleted.clear();
  }
  ans[x] = 0;
  for (int i = 1; i < n + 1; i++) {
    cout << ans[i] << " ";
  }
}
