#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  map<long long, long long> mp;
  vector<long long> v(n + 1, 0);
  for (int i = 0; i <= n; i++) {
    v[i] = i;
    if (i != 0) mp[i] = 1;
    ;
  }
  long long m;
  cin >> m;
  for (int j = 0; j < m; j++) {
    long long l, r, x;
    cin >> l >> r >> x;
    auto it = mp.lower_bound(l);
    vector<long long> toerase;
    for (auto i = it; i != mp.end(); i++) {
      if (i->first > r)
        break;
      else {
        v[i->first] = x;
        if (i->first != x) toerase.push_back(i->first);
      }
    }
    for (int i = 0; i < toerase.size(); i++) {
      mp.erase(toerase[i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (v[i] == i)
      cout << "0"
           << " ";
    else
      cout << v[i] << " ";
  }
  cout << endl;
  return 0;
}
