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