#include <bits/stdc++.h>
using namespace std;
int beatenby[300005];
set<int> alive;
set<int>::iterator it;
int n, m;
int pos;
int l, r, x;
int main() {
  alive.clear();
  memset(beatenby, 0, sizeof(beatenby));
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) alive.insert(i);
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &l, &r, &x);
    it = alive.lower_bound(l);
    while (*it <= r && it != alive.end()) {
      if (*it != x && *it >= l) {
        beatenby[*it] = x;
        alive.erase(it++);
      } else
        it++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", beatenby[i]);
  return 0;
}
