#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> B;
int getNext(int j) {
  if (j >= N) return j;
  if (j == B[j]) return j;
  return B[j] = getNext(B[j]);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    A[i] = i;
    B.push_back(i);
  }
  for (int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--, c--;
    int j = getNext(a);
    while (j <= b) {
      if (j == c) {
        j = j + 1;
      } else {
        A[j] = c;
        B[j] = j + 1;
      }
      j = getNext(j);
    }
  }
  for (int i = 0; i < N; i++) {
    if (A[i] == i)
      cout << 0 << " ";
    else
      cout << A[i] + 1 << " ";
  }
}
