#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int maxn = (long long int)1e9 + 7;
const double pi = acos(-1.0);
int arr[300005];
int tree[1200005];
void update(int node, int b, int e, int i, int j, int x) {
  if (b > j || e < i)
    return;
  else if (b >= i && e <= j && tree[node] != 0)
    return;
  else if (b >= i && e <= j && b == e && (b > x || e < x)) {
    if (tree[node] == 0) tree[node] = x;
    return;
  } else if (b == x && e == x) {
    tree[node] = 0;
    return;
  }
  int left = node << 1;
  int right = (node << 1) + 1;
  int m = (b + e) >> 1;
  update(left, b, m, i, j, x);
  update(right, m + 1, e, i, j, x);
  tree[node] = min(tree[left], tree[right]);
}
void print(int node, int b, int e) {
  if (b == e) {
    printf("%d ", tree[node]);
    return;
  }
  int left = node << 1;
  int right = (node << 1) + 1;
  int m = (b + e) >> 1;
  print(left, b, m);
  print(right, m + 1, e);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while (m--) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    update(1, 1, n, l, r, x);
  }
  print(1, 1, n);
  return 0;
}
