#include <bits/stdc++.h>
using namespace std;
const int N = 300100;
int bit[N];
int rt[N];
int fa[N];
int find(int x) { return fa[x] == x ? x : (fa[x] = find(fa[x])); }
int main() {
  int m, n, l, r, w;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 1; i <= n; i++) rt[i] = fa[i] = i;
    for (int i = 0; i < m; i++) {
      scanf("%d%d%d", &l, &r, &w);
      for (int j = l; j <= r; j++) {
        int k = find(j);
        if (k > r) break;
        fa[k] = w;
        bit[k] = w;
        rt[w] = max(rt[w], rt[k]);
        j = rt[k];
      }
      rt[w] = max(rt[w], r);
    }
    bit[w] = 0;
    for (int i = 1; i <= n; i++) {
      printf("%d ", bit[i]);
    }
    puts("");
  }
}
