#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int main() {
  int n, m;
  cin >> n >> m;
  set<int> seta;
  for (int i = 1; i <= n; i++) seta.insert(i);
  seta.insert(300005);
  set<int>::iterator it1, it2;
  int ans[300005]{0};
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    it1 = seta.lower_bound(a);
    while (*it1 <= b) {
      if (*it1 != c) {
        ans[*it1] = c;
        it2 = it1;
        it1++;
        seta.erase(it2);
      } else
        it1++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
