#include <bits/stdc++.h>
using namespace std;
struct Fight {
  int left, right, winner;
} fights[500110];
int n, ans[500110];
int main() {
  int m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++)
    scanf("%d %d %d", &fights[i].left, &fights[i].right, &fights[i].winner);
  set<int> status;
  set<int>::iterator it;
  for (int i = 1; i <= n; i++) status.insert(i);
  for (int i = 0; i < m; i++) {
    it = status.lower_bound(fights[i].left);
    while (it != status.end()) {
      if ((*it) > fights[i].right) break;
      if ((*it) != fights[i].winner) {
        ans[(*it)] = fights[i].winner;
        status.erase((*it));
        it = status.lower_bound(fights[i].left);
      } else
        ++it;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i != 1) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
