#include <bits/stdc++.h>
using namespace std;
int ans[300005], p[300005];
int getl(int x) {
  int i = x, j;
  while (x != p[x]) {
    x = p[x];
  }
  while (i != p[i]) {
    j = p[i];
    p[i] = x;
    i = j;
  }
  return x;
}
int main(void) {
  int m, n, l, r, x;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n + 1; i++) p[i] = i;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &l, &r, &x);
    int j = getl(l);
    while (j <= r) {
      if (j != x) {
        ans[j] = x;
        p[j] = j + 1;
      }
      j = j + 1;
      j = getl(j);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
