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