#include <bits/stdc++.h>
using namespace std;
int parent[300005], ans[300005], n, m;
int find(int x) {
  if (parent[x] == x) return x;
  return parent[x] = find(parent[x]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n >> m;
  for (int i = 1; i <= n + 5; i++) parent[i] = i;
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    for (int v = find(l); v < x; v = find(v)) {
      ans[v] = x;
      parent[v] = v + 1;
    }
    for (int v = find(x + 1); v <= r; v = find(v)) {
      ans[v] = x;
      parent[v] = v + 1;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
