#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, left, right, x;
  while (scanf("%d%d", &n, &m) == 2) {
    set<int> s;
    for (int i = 0; i < n; i++) s.insert(i);
    vector<int> v(n, 0);
    for (int i = 0; i < m; i++) {
      scanf("%d%d%d", &left, &right, &x);
      left--;
      right--;
      x--;
      set<int>::iterator pos = s.lower_bound(left);
      vector<int> er;
      for (; pos != s.end(); pos++) {
        if (*pos == x) continue;
        if (*pos > right) break;
        er.push_back(*pos);
      }
      for (int j = 0; j < er.size(); j++) {
        v[er[j]] = x + 1;
        s.erase(er[j]);
      }
    }
    for (int i = 0; i < n; i++) {
      if (i) printf(" ");
      printf("%d", v[i]);
    }
    printf("\n");
  }
  return 0;
}
