#include <bits/stdc++.h>
using namespace std;
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
int n, m;
int ans[500000];
set<int> tree;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (n); ++i) tree.insert(i);
  for (int i = 0; i < (m); ++i) {
    int a, b, win;
    scanf("%d%d%d", &a, &b, &win);
    while (1) {
      set<int>::iterator it = tree.lower_bound(a);
      if (it != tree.end() && *it <= b) {
        if (*it != win) ans[*it] = win;
        tree.erase(*it);
      } else
        break;
    }
    tree.insert(win);
  }
  for (int i = (1); i <= (n); ++i) {
    if (i > 1) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
