#include <bits/stdc++.h>
using namespace std;
int n, m, ans[300005], x[300005], y[300005], c[300005];
struct T1 {
  int b[300005 * 8];
  void Pushdown(int k, int l, int r) {
    if (b[k]) {
      b[k * 2] = b[k * 2 + 1] = b[k];
      b[k] = 0;
    }
  }
  void Insert(int k, int l, int r, int x, int y, int z) {
    Pushdown(k, l, r);
    if (l == x && r == y) {
      b[k] = z;
      return;
    }
    int mid = (l + r) / 2;
    if (mid < x)
      Insert(k * 2 + 1, mid + 1, r, x, y, z);
    else if (y <= mid)
      Insert(k * 2, l, mid, x, y, z);
    else {
      Insert(k * 2, l, mid, x, mid, z);
      Insert(k * 2 + 1, mid + 1, r, mid + 1, y, z);
    }
  }
  void GetAns(int k, int l, int r) {
    if (l == r) {
      ans[l] = b[k];
      return;
    }
    Pushdown(k, l, r);
    int mid = (l + r) / 2;
    GetAns(k * 2, l, mid);
    GetAns(k * 2 + 1, mid + 1, r);
  }
} T;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d%d%d", &x[i], &y[i], &c[i]);
  for (int i = m - 1; i >= 0; i--) {
    if (x[i] < c[i]) T.Insert(1, 1, n, x[i], c[i] - 1, c[i]);
    if (y[i] > c[i]) T.Insert(1, 1, n, c[i] + 1, y[i], c[i]);
  }
  T.GetAns(1, 1, n);
  for (int i = 1; i <= n; i++)
    if (i != c[m - 1])
      printf("%d ", ans[i]);
    else
      printf("0 ");
  return 0;
}
