#include <bits/stdc++.h>
using namespace std;
set<int> st;
vector<int> answ;
const int INF = 10000000;
int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  answ.resize(N);
  for (int i = 0; i < N; ++i) st.insert(i);
  st.insert(INF);
  st.insert(INF);
  for (int i = 0; i < M; ++i) {
    int l, r, w;
    scanf("%d%d%d", &l, &r, &w);
    --l, --r, --w;
    set<int>::iterator it = st.find(l);
    if (it == st.end()) it = st.upper_bound(l);
    while (*it <= r) {
      if (*it != w) {
        if (answ[*it] == 0) answ[*it] = w + 1;
        set<int>::iterator it1 = it;
        ++it1;
        st.erase(it);
        it = it1;
      } else
        ++it;
    }
  }
  for (int i = 0; i < N; ++i) printf("%d ", answ[i]);
  return 0;
}
