#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long l = v.size();
  for (long long i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long long N = 3e5 + 100;
long long n, arr[N], q;
set<long long> s;
map<long long, long long> ans;
int32_t main() {
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) {
    s.insert(i);
  }
  for (long long i = 0; i < q; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    s.erase(c);
    auto it_up = s.upper_bound(c);
    while (it_up != s.end() and *(it_up) <= b) {
      ans[(*it_up)] = c;
      s.erase(it_up);
      it_up = s.upper_bound(c);
    }
    auto it_low = s.lower_bound(c);
    while (it_low != s.begin()) {
      it_low--;
      if (*it_low >= a) {
        ans[(*it_low)] = c;
        s.erase(it_low);
      } else {
        break;
      }
      it_low = s.lower_bound(c);
    }
    s.insert(c);
  }
  for (long long i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
  return 0;
}
