#include <bits/stdc++.h>
using namespace std;
template <typename T>
void afill(T *arr, int size, T val) {
  fill(arr, arr + size, val);
}
long long mod = 1e9 + 7;
double eps = 1e-9;
int n, t, m, q, k;
int tree[1 << 20];
void update(int pos, int lo, int hi, int li, int ri, int win) {
  if (lo > hi || li > ri || tree[pos]) return;
  if (lo >= li && hi <= ri) {
    tree[pos] = win;
    return;
  }
  if (hi < li || lo > ri) return;
  int mid = (lo + hi) >> 1, l = pos << 1, r = l + 1;
  update(l, lo, mid, li, ri, win);
  update(r, mid + 1, hi, li, ri, win);
}
void print_results(int pos, int lo, int hi, int prev) {
  if (lo == hi) {
    if (tree[pos]) prev = tree[pos];
    cout << prev << " ";
    return;
  }
  int mid = (lo + hi) >> 1, l = pos << 1, r = l + 1;
  if (tree[pos]) prev = tree[pos];
  print_results(l, lo, mid, prev);
  print_results(r, mid + 1, hi, prev);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int li, ri, win;
    cin >> li >> ri >> win;
    update(1, 1, n, li, win - 1, win);
    update(1, 1, n, win + 1, ri, win);
  }
  print_results(1, 1, n, 0);
  cin >> n;
}
