#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans[300005];
set<int> remain;
set<int>::iterator it1;
set<int>::iterator it2;
set<int>::iterator it;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) remain.insert(i);
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    it1 = remain.lower_bound(l);
    it2 = remain.upper_bound(r);
    while (it1 != it2) {
      it = it1;
      it1++;
      if (*it != x) {
        ans[*it] = x;
        remain.erase(it);
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
