#include <bits/stdc++.h>
using namespace std;
set<int> s;
set<int>::iterator it;
int a[300005] = {0};
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  s.clear();
  for (int i = 1; i <= n; i++) s.insert(i);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    it = s.lower_bound(l);
    while (it != s.end() && *it <= r) {
      int h = *it;
      it++;
      if (h != x) {
        a[h] = x;
        s.erase(h);
      }
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
}
