#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans[300050];
int father[300050];
int l, r, x;
int getRoot(int current) {
  if (father[current] == current)
    return current;
  else
    return father[current] = getRoot(father[current]);
}
void solve() {
  int i = getRoot(l);
  while (i <= r) {
    if (i == x) {
      i += 1;
    } else {
      ans[i] = x;
      father[i] = i + 1;
      i++;
    }
    if (i <= r) i = getRoot(i);
  }
  return;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n + 1; i++) father[i] = i;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &l, &r, &x);
    solve();
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
