#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
vector<long long> gr[100001];
vector<long long> grev[200001];
long long ar[500005];
void solve() {
  long long n, m;
  cin >> n >> m;
  set<long long> alive;
  for (long long i = int(1); i < int(n + 1); i++) {
    alive.insert(i);
  }
  vector<long long> ans(n + 2, 0);
  for (long long i = int(0); i < int(m); i++) {
    long long l, r, winner;
    cin >> l >> r >> winner;
    auto it = alive.lower_bound(l);
    vector<long long> killed;
    while (it != alive.end() && *it <= r) {
      if (*it != winner) {
        killed.push_back(*it);
      }
      it++;
    }
    for (long long c : killed) {
      ans[c] = winner, alive.erase(c);
    }
  }
  for (long long i = int(1); i < int(n + 1); i++) cout << ans[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
