#include <bits/stdc++.h>
using namespace std;
const int OO = 1e9;
const double EPS = 1e-9;
struct E {
  int number;
  bool beaten = 0;
  int b_number = -1;
  E* next = NULL;
};
E arr[300005];
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n + 5; i++) {
    arr[i].number = i + 1;
    arr[i].next = &arr[i + 1];
  }
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    E* previous;
    E* curr = &arr[l - 1];
    while (curr != NULL) {
      previous = curr;
      curr = curr->next;
      if (previous->number > r) {
        break;
      }
      if (previous->number != x && !previous->beaten) {
        previous->beaten = 1;
        previous->b_number = x;
      }
      if (previous->number >= x) {
        previous->next = &arr[r];
      } else {
        previous->next = &arr[x - 1];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << (arr[i].beaten ? arr[i].b_number : 0);
    if (i != n - 1) {
      cout << " ";
    }
  }
  return 0;
}
