#include <bits/stdc++.h>
using namespace std;
int f[500060];
int ans[500060];
int find(int a) {
  int r = a;
  while (f[r] != r) r = f[r];
  int i = a;
  int j;
  while (i != r) {
    j = f[i];
    f[i] = r;
    i = j;
  }
  return r;
}
void merge(int a, int b) {
  int A, B;
  A = find(a);
  B = find(b);
  if (A != B) {
    if (A > B)
      f[B] = A;
    else
      f[A] = B;
  }
}
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= n; i++) f[i] = i;
    while (m--) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      if (find(l) == find(r))
        continue;
      else {
        for (int i = l; i <= r; i = find(i) + 1) {
          if (i == x) continue;
          if (ans[i] == 0) {
            ans[i] = x;
          }
          if (i != x && i != l) merge(i, i - 1);
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      printf("%d ", ans[i]);
    }
    printf("\n");
  }
}
