#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5;
int ans[N + 5];
int nxt[N + 5];
int find(int x) {
  if (nxt[x] == x) return x;
  return nxt[x] = find(nxt[x]);
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n + 1; i++) nxt[i] = i;
  while (k--) {
    int l, r, x;
    cin >> l >> r >> x;
    int curr = nxt[l];
    while (curr <= r) {
      if (curr == x)
        curr++;
      else {
        if (nxt[curr] == curr) ans[curr] = x;
        nxt[curr] = (curr + 1);
      }
      curr = find(curr);
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
