#include <bits/stdc++.h>
using namespace std;
int N, M, a[300005];
set<int> Q;
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) Q.insert(i);
  for (int i = 1, l, r, x; i <= M; i++) {
    scanf("%d%d%d", &l, &r, &x);
    for (set<int>::iterator j = Q.lower_bound(l), k; j != Q.end() && *j <= r;
         j = k) {
      k = j, k++;
      if (*j != x) a[*j] = x, Q.erase(j);
    }
  }
  for (int i = 1; i <= N; i++) printf("%d ", a[i]);
}
