#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int sum[4000005];
int cover[4000005];
int n, m;
void up(int rt) {
  if (cover[rt << 1] == cover[rt << 1 | 1] && cover[rt << 1] != -1 &&
      cover[rt << 1])
    cover[rt] = cover[rt << 1];
  else
    cover[rt] = -1;
}
void down(int rt) {
  if (cover[rt] == 1) {
    cover[rt << 1] = cover[rt << 1 | 1] = cover[rt];
    if (sum[rt << 1] == 0) sum[rt << 1] = sum[rt];
    if (sum[rt << 1 | 1] == 0) sum[rt << 1 | 1] = sum[rt];
  }
}
void build(int l, int r, int rt) {
  cover[rt] = 0;
  if (l == r) {
    cover[rt] = 0;
    sum[rt] = 0;
    return;
  }
  int m = (l + r) >> 1;
  build(l, m, rt << 1);
  build(m + 1, r, rt << 1 | 1);
  up(rt);
}
void update(int L, int R, int d, int l, int r, int rt) {
  if (L <= l && R >= r) {
    if (cover[rt] == 1) return;
    if (cover[rt] == 0) {
      cover[rt] = 1;
      sum[rt] = d;
      down(rt);
      return;
    }
  }
  int m = (l + r) >> 1;
  if (L <= m) update(L, R, d, l, m, rt << 1);
  if (R > m) update(L, R, d, m + 1, r, rt << 1 | 1);
  up(rt);
}
int query(int p, int l, int r, int rt) {
  if (l == r) return sum[rt];
  int m = (l + r) >> 1;
  int res = 0;
  if (p <= m) res += query(p, l, m, rt << 1);
  if (p > m) res += query(p, m + 1, r, rt << 1 | 1);
  return res;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    build(1, n, 1);
    for (int i = 0; i < m; i++) {
      int a, b, w;
      scanf("%d%d%d", &a, &b, &w);
      if (w - 1 >= a) update(a, w - 1, w, 1, n, 1);
      if (w + 1 <= b) update(w + 1, b, w, 1, n, 1);
    }
    for (int i = 1; i <= n; i++)
      printf(i == n ? "%d\n" : "%d ", query(i, 1, n, 1));
  }
  return 0;
}
