#include <bits/stdc++.h>
int next1[300005], win[300005];
bool vis[300005];
int n, m;
using namespace std;
int Find(int x) {
  return !vis[next1[x]] ? next1[x] : next1[x] = Find(next1[x]);
}
void solve(int l, int r, int x) {
  int goal = x;
  int p = l;
  while (p <= r) {
    if (!vis[p]) win[p] = x, vis[p] = true;
    int tmp = p;
    p = Find(p);
    if (tmp < x)
      next1[tmp] = x;
    else
      next1[tmp] = next1[r];
    if (p > x) goal = r;
    if (p > r) break;
  }
  vis[x] = false;
  win[x] = 0;
}
int main() {
  int l, r, x;
  cin >> n >> m;
  memset(vis, false, sizeof(vis));
  memset(win, 0, sizeof(win));
  for (int i = 1; i <= n; i++) next1[i] = i + 1;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &l, &r, &x);
    solve(l, r, x);
  }
  for (int i = 1; i <= n; i++) printf("%d ", win[i]);
  puts("");
  return 0;
}
