#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> knights(n);
  set<int> now;
  for (int i = 0; i < n; i++) now.insert(i + 1);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    set<int>::iterator it_left = now.lower_bound(l);
    set<int>::iterator it_right = now.upper_bound(r);
    for (set<int>::iterator it = it_left; it != it_right; it++) {
      int index = *it - 1;
      if (*it != x) knights[index] = x;
    }
    now.erase(it_left, it_right);
    now.insert(x);
  }
  for (int i = 0; i < n; i++) printf("%d ", knights[i]);
  return 0;
}
