#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
void solve() {
  int n, m;
  cin >> n >> m;
  set<int> liv;
  for (ll i = 0; i < (n); i++) liv.insert(i);
  vi ans(n, -1);
  for (ll i = 0; i < (m); i++) {
    int l, r, x;
    cin >> l >> r >> x;
    l--;
    r--;
    x--;
    auto it = liv.lower_bound(l);
    vi er;
    while (it != liv.end()) {
      int cur = *it;
      if (cur > r) break;
      if (cur != x) {
        ans[cur] = x;
        er.push_back(cur);
      }
      it++;
    }
    for (ll j = 0; j < (er.size()); j++) {
      liv.erase(er[j]);
    }
  }
  for (ll i = 0; i < (n); i++) cout << ans[i] + 1 << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  while (t--) {
    solve();
  }
}
