#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l, r, x, t;
  scanf("%d %d", &n, &m);
  vector<int> res(n);
  set<int> active;
  for (int i = 0; i < (n); i++) active.insert(i + 1);
  for (int i = 0; i < (m); i++) {
    scanf("%d %d %d", &l, &r, &x);
    vector<int> rem;
    for (set<int>::iterator it = active.lower_bound(l); it != active.end();
         ++it) {
      t = (*it);
      if (t > r) break;
      if (t != x) {
        res[t - 1] = x;
        rem.push_back(t);
      }
    }
    for (int j = 0; j < ((int)(rem).size()); j++) active.erase(rem[j]);
  }
  for (int i = 0; i < (n); i++) printf("%d ", res[i]);
  return 0;
}
