#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  set<int> have;
  for (int i = 0; i < n; i++) have.insert(i);
  vector<int> ans(n, -1);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    --l, --r, --x;
    set<int>::iterator minL = have.lower_bound(l);
    assert(*minL <= r);
    vector<int> killed;
    while (minL != have.end() && *minL <= r) {
      if (*minL == x) {
        ++minL;
        continue;
      }
      killed.push_back(*minL), ans[*minL] = x;
      ++minL;
    }
    for (int j = 0; j < (int)killed.size(); j++) have.erase(killed[j]);
  }
  for (int i = 0; i < n; i++) printf("%d%c", ans[i] + 1, " \n"[i == n - 1]);
  return 0;
}
