#include <bits/stdc++.h>
using namespace std;
const long long inf = 1LL << 28;
const long long mod = 1LL;
int tree[4 * 3 * 100010];
int lazy[4 * 3 * 100010];
struct data {
  int x, y, z;
};
data query[3 * 100010];
void build(int node, int b, int e) {
  tree[node] = lazy[node] = 0;
  if (b == e) {
    return;
  }
  int mid = (b + e) / 2;
  build(2 * node, b, mid);
  build((2 * node) + 1, mid + 1, e);
}
void update(int node, int b, int e, int f, int t, int cl) {
  if (b >= f && e <= t) {
    tree[node] = cl;
    lazy[node] = cl;
    return;
  }
  int mid = (b + e) / 2;
  if (lazy[node] && (b != e)) {
    tree[2 * node] = tree[(2 * node) + 1] = lazy[node];
    lazy[2 * node] = lazy[(2 * node) + 1] = lazy[node];
    lazy[node] = 0;
  }
  if (f <= mid) update(2 * node, b, mid, f, t, cl);
  if (t > mid) update((2 * node) + 1, mid + 1, e, f, t, cl);
  return;
}
int query1(int node, int b, int e, int pos, int last) {
  if (lazy[node] && (b != e)) {
    tree[2 * node] = tree[(2 * node) + 1] = lazy[node];
    lazy[2 * node] = lazy[(2 * node) + 1] = lazy[node];
    lazy[node] = 0;
  }
  if (b == e) {
    return tree[node];
  }
  int mid = (b + e) / 2;
  if (pos <= mid)
    return query1(2 * node, b, mid, pos, tree[node]);
  else
    return query1((2 * node) + 1, mid + 1, e, pos, tree[node]);
  return 0;
}
int main() {
  int i, j, k, n, m, l, r, v;
  while (scanf("%d %d", &n, &m) == 2) {
    for (i = 0; i < m; i++) {
      scanf("%d %d %d", &query[i].x, &query[i].y, &query[i].z);
    }
    build(1, 1, n);
    for (i = m - 1; i >= 0; i--) {
      l = query[i].x;
      r = query[i].y;
      v = query[i].z;
      if (v - 1 >= l) update(1, 1, n, l, v - 1, v);
      if (v + 1 <= r) update(1, 1, n, v + 1, r, v);
    }
    for (i = 1; i <= n; i++) {
      printf("%d ", query1(1, 1, n, i, 0));
    }
    printf("\n");
  }
  return 0;
}
