#include <bits/stdc++.h>
using namespace std;
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
const int N = 3e5 + 10;
int ans[N];
void solve() {
  memset(ans, -1, sizeof ans);
  set<int> s;
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) s.insert(i);
  for (int i = 0; i < m; ++i) {
    int x, y, w;
    cin >> x >> y >> w;
    vector<int> del;
    auto it = s.lower_bound(x);
    while (it != s.end()) {
      if (*it > y) break;
      if (*it != w) {
        ans[*it] = w;
        del.push_back(*it);
      }
      it++;
    }
    for (int i = 0; i < (int)del.size(); ++i) s.erase(s.find(del[i]));
  }
  for (auto it = s.begin(); it != s.end(); ++it) ans[*it] = 0;
  for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 1;
  while (tc--) {
    solve();
  }
}
