#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n, m, col[maxn];
set<int> s;
set<int>::iterator t[maxn];
int main() {
  while (~scanf("%d %d", &n, &m)) {
    s.clear();
    for (int i = 1; i <= n; i++) s.insert(i);
    int cnt = 0;
    while (m--) {
      int l, r, c;
      scanf("%d %d %d", &l, &r, &c);
      cnt = 0;
      for (auto it = s.lower_bound(l); *it <= r && it != s.end(); it++) {
        if (*it != c) {
          col[*it] = c;
          t[cnt++] = it;
        }
      }
      for (int i = 0; i < cnt; i++) {
        s.erase(t[i]);
      }
    }
    for (int i = 1; i <= n; i++) {
      printf("%d ", col[i]);
    }
    printf("\n");
  }
  return 0;
}
