#include <bits/stdc++.h>
using namespace std;
int conqr[3 * 100005];
int main() {
  int n, m;
  while (cin >> n >> m) {
    set<int> aliveSoldier;
    for (int i = 1; i <= n; i++) aliveSoldier.insert(i);
    while (m--) {
      int li, ri, xi;
      scanf("%d %d", &li, &ri);
      ;
      scanf("%d", &xi);
      ;
      set<int>::iterator it;
      vector<int> todel;
      it = aliveSoldier.lower_bound(li);
      for (auto itr = it; itr != aliveSoldier.end(); itr++) {
        int idn = *itr;
        if (idn > ri) break;
        if (idn == xi) continue;
        conqr[idn] = xi;
        todel.push_back(idn);
      }
      for (int i = 0; i < todel.size(); i++) aliveSoldier.erase(todel[i]);
      todel.clear();
    }
    for (int i = 1; i <= n; i++) {
      if (conqr[i] == i)
        printf("0 ");
      else
        printf("%d ", conqr[i]);
    }
    printf("\n");
  }
  return 0;
}
