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