#include <bits/stdc++.h>
int pre[300050], vis[300050], a[300050], num[300050], sec;
int find(int x) {
  if (pre[x] == x) {
    return x;
  } else {
    pre[x] = find(pre[x]);
    return pre[x];
  }
}
int main() {
  int n, m, i, j, x, y;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    pre[i] = i;
    a[i] = i + 1;
  }
  for (i = 1; i <= m; i++) {
    scanf("%d%d%d", &x, &y, &sec);
    int temp;
    for (j = x; j <= y; j = temp) {
      int xx = find(j);
      if (j == pre[j]) {
        num[j] = sec;
      }
      pre[xx] = sec;
      num[xx] = sec;
      temp = a[j];
      a[j] = y + 1;
    }
  }
  num[sec] = 0;
  for (i = 1; i <= n; i++) {
    printf("%d ", num[i]);
  }
}
