#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, x, st[6000006];
int update(int a, int b, int qa, int qb, int act, int pos) {
  if (a == b && qa <= a && a <= qb) {
    if (st[pos] != 0) return st[pos];
    if (a != x)
      return st[pos] = x;
    else
      return 0;
  }
  if (qa <= a && qb >= b && st[pos] != 0) return st[pos];
  if (qa > b || qb < a) return 0;
  int m = (a + b) / 2;
  int a1 = update(a, m, qa, qb, act, pos * 2 + 1);
  int a2 = update(m + 1, b, qa, qb, act, pos * 2 + 2);
  if (st[pos] == 0)
    return st[pos] = min(a1, a2);
  else
    return st[pos];
}
void res(int a, int b, int pos) {
  if (a == b) {
    cout << st[pos] << ' ';
    return;
  }
  int m = (a + b) / 2;
  res(a, m, pos * 2 + 1);
  res(m + 1, b, pos * 2 + 2);
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> x;
    update(1, n, l, r, x, 0);
  }
  res(1, n, 0);
}
