#include <bits/stdc++.h>
using namespace std;
int ans[300005];
int main() {
  ios_base ::sync_with_stdio(0);
  set<int> numbers;
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    numbers.insert(i);
  }
  while (m--) {
    int l, r, x;
    cin >> l >> r >> x;
    set<int>::iterator lower = numbers.lower_bound(l);
    set<int>::iterator upper = numbers.upper_bound(r);
    while (lower != upper) {
      int cur = *lower;
      lower++;
      if (cur != x) {
        ans[cur] = x;
        numbers.erase(cur);
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
