#include <bits/stdc++.h>
using namespace std;
int v[3 * 100000 + 2], r[3 * 100000 + 2];
int Find(int n) { return r[n] == n ? n : r[n] = Find(r[n]); }
int main() {
  int n, m, a, b, c;
  cin >> n >> m;
  for (int i = 0; i <= n + 1; i++) r[i] = i;
  while (m--) {
    cin >> a >> b >> c;
    while ((a = Find(a)) <= b) {
      if (a != c) {
        v[a] = c;
        r[a] = a + 1;
      }
      a++;
    }
  }
  for (int i = 1; i <= n; i++) cout << v[i] << " ";
  return 0;
}
