#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 6;
int ans[N];
int main() {
  int n, m, l, r, x;
  cin >> n >> m;
  set<int> st;
  for (int i = 1; i <= n; ++i) {
    st.insert(i);
  }
  for (int i = 0; i < m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    auto it = st.lower_bound(l);
    vector<int> toErase;
    while (it != st.end()) {
      int cur = *it;
      if (cur > r) break;
      if (cur != x) {
        toErase.push_back(cur);
        ans[cur] = x;
      }
      it++;
    }
    for (int j = 0; j < toErase.size(); j++) st.erase(toErase[j]);
  }
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}
