#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int l, r, x;
  bool *still = new bool[n];
  int *re = new int[n];
  int *next = new int[n];
  int i, i2, i3;
  for (i = 0; i < n; i++) {
    still[i] = true;
    re[i] = 0;
    next[i] = i + 1;
  }
  for (i = 0; i < m; i++) {
    cin >> l >> r >> x;
    for (i2 = l - 1; i2 <= r - 1;) {
      if (still[i2] && i2 != x - 1) {
        still[i2] = false;
        re[i2] = x;
      }
      i3 = i2;
      i2 = next[i2];
      if (i3 < x - 1)
        next[i3] = x - 1;
      else
        next[i3] = r;
    }
  }
  for (i = 0; i < n; i++) {
    if (i != 0) cout << ' ';
    cout << re[i];
  }
  delete[] re;
  delete[] still;
  delete[] next;
  return 0;
}
