#include <bits/stdc++.h>
using namespace std;
int parent[300001];
int quick[300001];
int serie[300001];
void init() {
  for (int i = 0; i < 300001; i++) {
    parent[i] = i;
    quick[i] = i;
    serie[i] = i;
  }
}
int u_find(int p) {
  if (quick[p] == p) return p;
  quick[p] = u_find(quick[p]);
  return quick[p];
}
void u_union(int astart, int aend, int winner) {
  int temp;
  for (int j = astart; j <= aend; j++) {
    temp = u_find(j);
    parent[temp] = winner;
    quick[temp] = winner;
    j = serie[temp];
    serie[winner] = serie[winner] > serie[temp] ? serie[winner] : serie[temp];
  }
  serie[winner] = serie[winner] > aend ? serie[winner] : aend;
}
int main() {
  int n, m;
  int astart, aend, winner;
  cin >> n >> m;
  init();
  while (m--) {
    cin >> astart >> aend >> winner;
    u_union(astart, aend, winner);
  }
  for (int i = 1; i <= n; i++) {
    if (parent[i] == i)
      cout << "0 ";
    else
      cout << parent[i] << " ";
  }
  cout << endl;
  return 0;
}
