#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r, ls, rs, val;
};
node a[2 * 300009];
int ans[300009];
void update(int node, int x, int y, int val) {
  if (a[node].val != 0) return;
  if (a[node].l >= x && a[node].r <= y) {
    a[node].val = val;
  } else {
    if (a[a[node].ls].r >= x) update(a[node].ls, x, y, val);
    if (a[a[node].rs].l <= y) update(a[node].rs, x, y, val);
  }
}
void solve(int node) {
  if (a[node].l == a[node].r) {
    ans[a[node].l] = a[node].val;
  } else {
    if (a[node].val != 0) {
      if (a[a[node].ls].val == 0) a[a[node].ls].val = a[node].val;
      if (a[a[node].rs].val == 0) a[a[node].rs].val = a[node].val;
    }
    solve(a[node].ls);
    solve(a[node].rs);
  }
}
int main() {
  int N, M, l, r, x, y, i;
  cin >> N >> M;
  x = 0;
  y = 1;
  a[0].l = 1;
  a[0].r = N;
  while (x < y) {
    if (a[x].l < a[x].r) {
      a[y].l = a[x].l;
      a[y].r = (a[x].l + a[x].r) / 2;
      a[x].ls = y++;
      a[y].l = a[y - 1].r + 1;
      a[y].r = a[x].r;
      a[x].rs = y++;
    }
    x++;
  }
  for (; M > 0; M--) {
    scanf("%d %d %d", &l, &r, &x);
    if (l < x) update(0, l, x - 1, x);
    if (x < r) update(0, x + 1, r, x);
  }
  solve(0);
  for (i = 1; i <= N; i++) printf("%d ", ans[i]);
}
