#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4 * 1e5 + 256;
set<int> arms;
int n, m;
vector<int> del;
int ans[MAXN];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) arms.insert(i);
  while (m--) {
    int l, r, x;
    cin >> l >> r >> x;
    auto it = arms.lower_bound(l);
    while (it != arms.end() && *it <= r) {
      if (*it != x) {
        ans[*it] = x;
        del.push_back(*it);
      }
      it++;
    }
    for (auto &go : del) arms.erase(go);
    del.clear();
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
  return 0;
}
