#include <bits/stdc++.h>
using namespace std;
const long long T = 300002;
const long long MAXD = T * T * T;
int n, m;
int P[T];
int NEXTS[T];
set<int> S;
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = (int)1; i <= (int)n; i++) {
    P[i] = i;
  }
  for (int i = (int)1; i <= (int)n; i++) {
    S.insert(i);
  }
  for (int i = (int)1; i <= (int)m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    int k = *S.lower_bound(l);
    while (k <= r) {
      if (P[k] == k) {
        P[k] = x;
      }
      if (k != x) {
        S.erase(k);
      }
      if (S.lower_bound(k + 1) == S.end()) {
        break;
      }
      k = *S.lower_bound(k + 1);
    }
  }
  for (int i = (int)1; i <= (int)n; i++) {
    if (P[i] == i) {
      printf("0 ");
    } else {
      printf("%d ", P[i]);
    }
  }
  return 0;
}
