#include <bits/stdc++.h>
using namespace std;
int ar[300090], rr[300090], N, M;
int main() {
  while (cin >> N >> M) {
    for (int i = 0, _n = N; i < _n; i++) {
      ar[i] = 0;
      rr[i] = i;
    }
    for (int j = 0, _n = M; j < _n; j++) {
      int a, b, c;
      scanf("%d%d%d", &a, &b, &c);
      a--, b--, c--;
      for (int i = a; i <= b; i++) {
        int x = rr[i];
        if (!ar[i] && i != c) {
          ar[i] = c + 1;
        }
        if (i < c) {
          rr[i] = c - 1;
        }
        if (i > c) {
          rr[i] = b;
        }
        i = x;
      }
    }
    for (int i = 0, _n = N; i < _n; i++) cout << ar[i] << " ";
  }
  return 0;
}
