#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double PI = acos(-1);
const long long mod = 1e9 + 7;
const long long OO = 2e18;
const int N = 3e5 + 5;
int parent[N];
set<int> st;
set<int>::iterator it1, it2;
int n, m, l, r, x;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) st.insert(i);
  st.insert(oo);
  while (m--) {
    cin >> l >> r >> x;
    it1 = st.lower_bound(l);
    while (*it1 <= r) {
      if (*it1 != x) {
        parent[*it1] = x;
        it2 = it1;
        it1++;
        st.erase(it2);
      } else
        it1++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << parent[i] << " ";
  }
}
