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