#include using namespace std; typedef long long ll; const int INF = 1000000100; const ll INFL = 2e18; template bool chmin(T &a, T b){ if (a > b) { a = b; return true;} else return false;} template bool chmax(T &a, T b){ if (a < b) { a = b; return true;} else return false;} using P = pair; int main() { int N,Q; cin >> N >> Q; vector ans(N,INF); multiset st; vector> query(N); priority_queue, greater

> pq; for (int i = 0;i < Q;i++) { int l, r, B; cin >> l >> r >> B; l--, r--; query[l].push_back({r, B}); } int rem = Q; map mp; for (int i = 0;i < N;i++) { for (int j = 0;j < query[i].size();j++) { int r, B; tie(r, B) = query[i][j]; st.insert(B); pq.push({r, B}); mp[B]++; } if (st.size()) { ans[i] = *st.rbegin(); rem -= mp[*st.rbegin()]; mp[*st.rbegin()] = 0; } while (pq.size() && i == pq.top().first) { int r,B; tie(r, B) = pq.top(); pq.pop(); st.erase(st.find(B)); } } if (rem) { cout << -1 << endl; } else { for (int i = 0;i < N;i++) { if (i != N-1)cout << ans[i] << " "; else cout << ans[i] << endl; } } }