#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  scanf("%d %d", &N, &M);
  int beat[N + 5], i;
  memset(beat, 0, sizeof(beat));
  set<int> S;
  for (int i = 1; i <= N; i++) S.insert(i);
  int L, R, W;
  set<int>::iterator it;
  while (M--) {
    scanf("%d %d %d", &L, &R, &W);
    set<int>::iterator lt = S.lower_bound(L);
    set<int>::iterator rt = S.upper_bound(R);
    for (it = lt; it != rt; it++) {
      int val = *it;
      if (val != W) beat[val] = W;
    }
    S.erase(lt, rt);
    S.insert(W);
  }
  for (int i = 1; i <= N - 1; i++) printf("%d ", beat[i]);
  printf("%d\n", beat[N]);
  return 0;
}
