#include <bits/stdc++.h>
using namespace std;
const int Max = 3e5 + 10;
const int Mod = 1e9 + 7;
const long long int Inf = 1LL << 62;
int ans[Max];
int main() {
  int n, m, l, r, x;
  scanf("%d %d", &n, &m);
  set<int> st;
  for (int i = 1; i <= n; i++) {
    st.insert(i);
  }
  while (m--) {
    scanf("%d %d %d", &l, &r, &x);
    vector<int> vec;
    auto it = st.lower_bound(l);
    while (it != st.end()) {
      int cur = *it;
      if (cur > r) {
        break;
      }
      if (cur != x) {
        vec.push_back(cur);
      }
      it++;
    }
    for (int it : vec) {
      st.erase(it);
      ans[it] = x;
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
