#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000000,102400000000")
using namespace std;
const int INF = 1000000000;
const double eps = 1e-10;
const int MAXN = 300010;
const int MOD = 1000000;
int n, m;
set<int> S;
set<int>::iterator it, ig;
int ret[MAXN];
int main() {
  cin >> n >> m;
  int l, r, x;
  for (int i = (1); i <= (n); ++i) S.insert(i);
  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    it = S.lower_bound(l);
    for (ig = it; ig != S.end();) {
      if ((*ig) == x) {
        ig++;
        continue;
      }
      if ((*ig) > r) break;
      it = ig;
      it++;
      ret[(*ig)] = x;
      S.erase(ig);
      ig = it;
    }
  }
  for (int i = (1); i <= (n); ++i) printf("%d ", ret[i]);
  puts("");
  return 0;
}
