#include <bits/stdc++.h>
using namespace std;
int ans[300005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  set<int> alive;
  for (int i = 1; i <= n; i++) alive.insert(i);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    set<int>::iterator it = alive.lower_bound(l);
    vector<int> dead;
    while (it != alive.end()) {
      int now = *it;
      if (now > r) break;
      if (now != x) dead.push_back(now), ans[now] = x;
      it++;
    }
    for (int j = 0; j < (int)((dead).size()); j++) alive.erase(dead[j]);
  }
  for (int i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
  return 0;
}
