#include <bits/stdc++.h>
struct tree {
  int fl, status;
};
tree T[4 * 300100];
int n, m;
void init(int node, int b, int e);
void update(int node, int b, int e, int k, int l, int val);
int query(int node, int b, int e, int k);
int main() {
  int i, j, k, l, test, t = 1;
  scanf("%d %d", &n, &m);
  init(1, 1, n);
  int li, ri, xi;
  for (i = 1; i <= m; i++) {
    scanf("%d %d %d", &li, &ri, &xi);
    update(1, 1, n, li, xi - 1, xi);
    update(1, 1, n, xi + 1, ri, xi);
  }
  for (i = 1; i <= n; i++) {
    int ans = query(1, 1, n, i);
    if (ans == i) ans = 0;
    if (i > 1) printf(" ");
    printf("%d", ans);
  }
  puts("");
  return 0;
}
int query(int node, int b, int e, int k) {
  if (b == e) {
    return T[node].status;
  }
  int left, right, mid;
  mid = b + e;
  mid /= 2;
  left = node << 1;
  right = left + 1;
  if (T[node].fl) {
    update(left, b, mid, b, mid, T[node].status);
    update(right, mid + 1, e, mid + 1, e, T[node].status);
    T[node].fl = 0;
  }
  if (k <= mid) return query(left, b, mid, k);
  return query(right, mid + 1, e, k);
}
void update(int node, int b, int e, int k, int l, int val) {
  if (k > l) return;
  if (b == e) {
    T[node].fl = 0;
    if (T[node].status == b) T[node].status = val;
    return;
  }
  int left, right, mid;
  mid = b + e;
  mid /= 2;
  left = node << 1;
  right = left + 1;
  if (T[node].fl) {
    update(left, b, mid, b, mid, T[node].status);
    update(right, mid + 1, e, mid + 1, e, T[node].status);
    T[node].fl = 0;
    return;
  }
  if (b == k && e == l) {
    T[node].fl = 1;
    T[node].status = val;
    return;
  }
  if (l <= mid)
    update(left, b, mid, k, l, val);
  else if (k > mid)
    update(right, mid + 1, e, k, l, val);
  else {
    update(left, b, mid, k, mid, val);
    update(right, mid + 1, e, mid + 1, l, val);
  }
}
void init(int node, int b, int e) {
  if (b == e) {
    T[node].fl = 0;
    T[node].status = b;
    return;
  }
  int left, right, mid;
  mid = b + e;
  mid /= 2;
  left = node << 1;
  right = left + 1;
  init(left, b, mid);
  init(right, mid + 1, e);
  T[node].fl = 0, T[node].status = 0;
}
