#include <bits/stdc++.h>
using namespace std;
using namespace std;
struct Info {
  int l, r, x;
};
int res[333333];
struct Node {
  int l, r;
  int flag;
} node[333333 * 6];
struct Seg {
  void pushdown(int x) {
    if (node[x].flag != -1) {
      node[(x) << 1].flag = node[(x) << 1 | 1].flag = node[x].flag;
      node[x].flag = -1;
    }
  }
  void build(int l, int r, int x = 1) {
    node[x].l = l, node[x].r = r;
    node[x].flag = -1;
    if (l == r) {
      return;
    }
    int mid = l + r >> 1;
    build(l, mid, (x) << 1);
    build(mid + 1, r, (x) << 1 | 1);
  }
  void biaoji(int l, int r, int val, int x = 1) {
    if (node[x].l >= l && node[x].r <= r) {
      node[x].flag = val;
      return;
    }
    int mid = (node[x].l + node[x].r) / 2;
    pushdown(x);
    if (l <= mid) biaoji(l, r, val, (x) << 1);
    if (r > mid) biaoji(l, r, val, (x) << 1 | 1);
  }
  int query(int v, int x = 1) {
    if (node[x].flag != -1 || node[x].l == node[x].r) {
      return node[x].flag;
    }
    int mid = (node[x].l + node[x].r) / 2;
    pushdown(x);
    if (v <= mid) return query(v, (x) << 1);
    if (v > mid) return query(v, (x) << 1 | 1);
  }
} seg;
int main() {
  memset((res), 0x3f, sizeof(res));
  int n, m;
  scanf("%d%d", &(n), &(m));
  seg.build(1, n);
  vector<Info> caozuo;
  for (int i = 0; i < m; i++) {
    int l, r, x;
    scanf("%d%d%d", &(l), &(r), &(x));
    caozuo.push_back((Info){l, r, x});
  }
  reverse(caozuo.begin(), caozuo.end());
  for (int i = 0; i < m; i++) {
    int val = seg.query(caozuo[i].x);
    if (val == -1) {
      if (res[caozuo[i].x] == 0x3f3f3f3f) res[caozuo[i].x] = 0;
    } else {
      if (res[caozuo[i].x] == 0x3f3f3f3f) res[caozuo[i].x] = val;
    }
    seg.biaoji(caozuo[i].l, caozuo[i].r, caozuo[i].x);
  }
  for (int i = 1; i <= n; i++)
    if (res[i] == 0x3f3f3f3f) res[i] = seg.query(i);
  for (int i = 1; i <= n; i++) printf("%d ", res[i]);
  return 0;
}
