#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const int mod = 1e9 + 7;
int n, m, l[N], r[N], x[N], ans[N];
set<int> st;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) st.insert(i);
  for (int i = 0; i < m; i++) {
    vector<int> temp;
    int l, r, x;
    cin >> l >> r >> x;
    auto it = st.lower_bound(l);
    while (*it <= r && it != st.end()) {
      if (*it != x) {
        temp.push_back(*it);
        ans[*it] = x;
      }
      it++;
    }
    for (int i = 0; i < temp.size(); i++) st.erase(temp[i]);
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
