#include <bits/stdc++.h>
using namespace std;
int n, m, fa[300005], res[300005];
int find(int x) {
  if (x != fa[x]) fa[x] = find(fa[x]);
  return fa[x];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n + 1; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    for (int i = find(l); i <= r; i = find(i + 1))
      if (i != x) {
        fa[i] = i + 1;
        res[i] = x;
      }
  }
  for (int i = 1; i <= n; i++) printf("%d%s", res[i], (i == n ? "\n" : " "));
  return 0;
}
