#include <bits/stdc++.h>
using namespace std;
int const N = 3 * 1e5 + 20;
int a[N];
map<int, int> vis;
int main() {
  set<int> data;
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    data.insert(i);
  }
  vector<int> ans(n + 1);
  while (m--) {
    int l, r, x;
    cin >> l >> r >> x;
    vector<int> a;
    auto left = data.lower_bound(l);
    auto right = data.upper_bound(r);
    while (left != right) {
      if (*left != x) {
        a.push_back(*left);
      }
      ++left;
    }
    for (auto i : a) {
      ans[i] = x;
      data.erase(i);
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << ' ';
  }
  return 0;
}
