#include <bits/stdc++.h>
#pragma warning(disable : 4786)
using namespace std;
int son[300010], par[300010];
int find(int x) {
  if (son[x] != x) son[x] = find(son[x]);
  return son[x];
}
int main(void) {
  int m, n;
  cin >> n >> m;
  for (int i = 1; i <= n + 1; i++) son[i] = i;
  for (int i = 1; i <= m; i++) {
    int l, h, x;
    cin >> l >> h >> x;
    int cur = find(l);
    while (1) {
      if (cur == x) break;
      par[cur] = x;
      son[cur] = cur + 1;
      cur = find(cur);
    }
    cur = find(x + 1);
    while (1) {
      if (cur > h) break;
      par[cur] = x;
      son[cur] = cur + 1;
      cur = find(cur);
    }
  }
  for (int i = 1; i <= n; i++) cout << par[i] << " ";
  cout << endl;
}
