#include <bits/stdc++.h>
using namespace std;
const int maxn = 333333;
int ans[maxn];
int fa[maxn];
int nx[maxn];
int visit[maxn];
int n, m;
inline int query(int a) { return a == fa[a] ? a : fa[a] = query(fa[a]); }
inline void conbine(int a, int b) {
  a = query(a), b = query(b);
  if (a != b) fa[a] = b;
}
inline void paint(int l, int r, int x) {
  int i = l;
  while (i <= r) {
    int a = query(i);
    int j = nx[a];
    if (j > r) return;
    if (ans[j] == 0) ans[j] = x;
    int b = query(j + 1);
    int _nx = nx[b];
    conbine(a, b);
    nx[query(a)] = _nx;
    i = _nx;
  }
}
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 0; i <= n + 1; ++i) fa[i] = nx[i] = i, ans[i] = 0;
    for (int i = 0; i < m; ++i) {
      int l, r, x;
      scanf("%d%d%d", &l, &r, &x);
      paint(l, x - 1, x);
      paint(x + 1, r, x);
    }
    for (int i = 1; i <= n; ++i) {
      int tmp = ans[i];
      printf("%d", tmp);
      if (i == n)
        printf("\n");
      else
        printf(" ");
    }
  }
  return 0;
}
