#include <bits/stdc++.h>
using namespace std;
int a[300001], Next[300001], ans[300001];
int get(int v) {
  if (Next[v] == v) return v;
  return Next[v] = get(Next[v]);
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n + 1; i++) Next[i] = i;
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    l = get(l);
    for (; l <= r;) {
      if (l == x)
        l++;
      else
        ans[l] = x, Next[l] = l + 1;
      l = get(l);
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
