#include <bits/stdc++.h>
using namespace std;
const int MAX = 300005;
pair<int, int> seg[2 * MAX];
void update(int l, int r, int fight, int value) {
  for (l += MAX, r += MAX; l < r; l >>= 1, r >>= 1) {
    if (l & 1) seg[l++] = make_pair(fight, value);
    if (r & 1) seg[--r] = make_pair(fight, value);
  }
}
int query(int p) {
  pair<int, int> res = make_pair(INT_MAX, 0);
  for (p += MAX; p > 1; p >>= 1) res = min(res, seg[p]);
  return res.second;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<pair<int, int>, int> > v;
  for (int i = 0; i < 2 * MAX; i++) seg[i] = make_pair(INT_MAX, 0);
  for (int i = 0; i < m; i++) {
    int a, b, x;
    cin >> a >> b >> x;
    v.push_back(make_pair(make_pair(a, b), x));
  }
  for (int i = m - 1; i >= 0; i--) {
    int l = v[i].first.first;
    int r = v[i].first.second;
    int win = v[i].second;
    update(l - 1, win - 1, i, win);
    update(win, r, i, win);
  }
  for (int i = 0; i < n; i++) cout << query(i) << " ";
  return 0;
}
