#include #include #include using namespace std; using namespace atcoder; typedef pair P; typedef pair PP; const int INF = 1000000000; struct S { int x; }; S op(S a, S b){ return S{min(a.x, b.x)}; } S e(){ return S{INF}; } struct F { int f; }; S mapping(F f, S a){ if(f.f == 0) return a; return S{f.f}; } F composition(F f, F g){ if(f.f == 0) return g; return f; } F id(){ return F{0}; } int main() { int n, q; cin >> n >> q; PP p[200005]; for(int i = 0; i < q; i++){ int l, r, b; cin >> l >> r >> b; l--; p[i] = PP(b, P(l, r)); } sort(p, p + q); lazy_segtree seg(n); for(int i = 0; i < q; i++){ seg.apply(p[i].second.first, p[i].second.second, F{p[i].first}); } for(int i = 0; i < q; i++){ if(seg.prod(p[i].second.first, p[i].second.second).x != p[i].first){ cout << -1 << endl; return 0; } } for(int i = 0; i < n; i++){ cout << seg.get(i).x; if(i < n - 1) cout << " "; } cout << endl; }