#include <bits/stdc++.h>
using namespace std;
int val[300005];
set<int> s;
vector<int> v;
int main() {
  int n, m, l, r, x;
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++) s.insert(i);
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> x;
    set<int>::iterator it = s.lower_bound(l);
    while (it != s.end()) {
      if (*it > r)
        break;
      else if (*it != x) {
        val[*it] = x;
        v.push_back(*it);
      }
      it++;
    }
    for (int i = 0; i < v.size(); i++) s.erase(v[i]);
    v.clear();
  }
  for (int i = 1; i < n + 1; i++) cout << val[i] << " ";
}
