#include <bits/stdc++.h>
using namespace std;
vector<int> par;
int n, m;
int find(int i) { return par[i] == i || i > n ? i : par[i] = find(par[i]); }
int main() {
  scanf("%d%d", &n, &m);
  par.resize(n + 3);
  for (int i = 1; i <= n; i++) par[i] = i;
  vector<int> A(n + 3, 0);
  while (m--) {
    int l, r;
    cin >> l >> r;
    int x;
    cin >> x;
    for (int i = find(l); i <= r; i = find(i + 1))
      if (i != x) A[i] = x, par[i] = i + 1;
  }
  for (int i = 1; i <= n; i++) cout << A[i] << ' ';
  return 0;
}
