#include <bits/stdc++.h>
using namespace std;
int n, m;
set<int> s;
int ans[300005];
set<int>::iterator it;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    s.insert(i);
  }
  while (m--) {
    int l, r, x;
    cin >> l >> r >> x;
    it = s.lower_bound(l);
    vector<int> temp;
    while (it != s.end()) {
      int res = *it;
      if (res > r) break;
      if (res != x) {
        ans[res] = x;
        temp.push_back(res);
      }
      it++;
    }
    for (auto i : temp) s.erase(i);
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
