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