#include <bits/stdc++.h>
using namespace std;
int query_no[1200000], MX = 999999999, x[300100];
int query(int node, int it, int f, int q);
void update(int node, int it, int f, int q1, int q2, int id);
void insert(int node, int it, int f);
int main() {
  int n, m, i, l, r, id;
  scanf("%d%d", &n, &m);
  insert(1, 1, n);
  for (i = 1; i <= m; i++) {
    scanf("%d%d%d", &l, &r, &x[i]);
    if (x[i] - 1 >= l) update(1, 1, n, l, x[i] - 1, i);
    if (x[i] + 1 <= r) update(1, 1, n, x[i] + 1, r, i);
  }
  update(1, 1, n, x[m], x[m], 0);
  for (i = 1; i <= n; i++) {
    id = query(1, 1, n, i);
    printf("%d", x[id]);
    if (i < n) printf(" ");
  }
  printf("\n");
  return 0;
}
void insert(int node, int it, int f) {
  query_no[node] = MX;
  if (it == f) return;
  insert(2 * node, it, (it + f) / 2);
  insert(2 * node + 1, (it + f) / 2 + 1, f);
}
void update(int node, int it, int f, int q1, int q2, int id) {
  if (it == q1 && f == q2) {
    query_no[node] = min(id, query_no[node]);
    return;
  }
  int m = (it + f) / 2;
  if (q2 <= m)
    update(2 * node, it, m, q1, q2, id);
  else if (q1 > m)
    update(2 * node + 1, m + 1, f, q1, q2, id);
  else {
    update(2 * node, it, m, q1, m, id);
    update(2 * node + 1, m + 1, f, m + 1, q2, id);
  }
}
int query(int node, int it, int f, int q) {
  if (it == f) return query_no[node];
  int m = (it + f) / 2;
  if (q <= m)
    return min(query_no[node], query(2 * node, it, m, q));
  else
    return min(query_no[node], query(2 * node + 1, m + 1, f, q));
}
