#include <bits/stdc++.h>
using namespace std;
const int N = 300100;
int par[N], szz[N], ans[N], arr[N];
void init() {
  for (int i = 0; i < N; i++) par[i] = i, szz[i] = 1;
}
int find(int u) { return u == par[u] ? u : par[u] = find(par[u]); }
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  init();
  for (int i = 1; i <= m; i++) {
    int l, r, x;
    scanf("%d", &l);
    scanf("%d", &r);
    scanf("%d", &x);
    for (int j = find(l); j <= r; j = find(j + 1)) {
      if (j == x) continue;
      ans[j] = x;
      par[find(j)] = find(j + 1);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
