#include <bits/stdc++.h>
using namespace std;
int n, m;
int t[300000 * 4];
int a[300001];
void build(int v, int left, int right) {
  if (left == right)
    t[v] = 1;
  else {
    int middle = left + (right - left) / 2;
    build(v * 2, left, middle);
    build(v * 2 + 1, middle + 1, right);
  }
  t[v] = 1;
}
void update(int v, int left, int right, int lQuery, int rQuery, int winner) {
  if (lQuery > right || rQuery < left) return;
  if (t[v] == 0) return;
  if (left == right) {
    if (left != winner) {
      t[v] = 0;
      a[left] = winner;
    }
    return;
  }
  int middle = left + (right - left) / 2;
  update(v * 2, left, middle, lQuery, rQuery, winner);
  update(v * 2 + 1, middle + 1, right, lQuery, rQuery, winner);
  t[v] = t[v * 2] | t[v * 2 + 1];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cout.tie(0);
  ;
  cin >> n >> m;
  build(1, 1, n);
  while (m--) {
    int l, r, winner;
    cin >> l >> r >> winner;
    update(1, 1, n, l, r, winner);
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
