#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const double eps = 1e-15;
const int N = 300100;
int beat[N];
set<int> st;
set<int>::iterator it, last;
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    st.clear();
    for (int i = 1; i <= n; ++i) {
      st.insert(i);
    }
    int l, r, x;
    memset(beat, 0, sizeof(beat));
    while (m--) {
      scanf("%d%d%d", &l, &r, &x);
      it = st.lower_bound(l);
      while (it != st.end() && *it <= r) {
        if (*it == x) {
          ++it;
          continue;
        }
        beat[*it] = x;
        last = it;
        ++it;
        st.erase(*last);
      }
    }
    printf("%d", beat[1]);
    for (int i = 2; i <= n; ++i) {
      printf(" %d", beat[i]);
    }
    printf("\n");
  }
  return 0;
}
