//#define _GLIBCXX_DEBUG #include #include #include #include using namespace std; using namespace atcoder; using mint = modint1000000007; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; using vb = vector; using vvb = vector; using vm = vector; using vvm = vector; using vpi = vector; using vvpi = vector; using vpl = vector; using vvpl = vector; const int inf = 1 << 30; const ll INF = 1LL << 60; #define rep(i,m,n) for (int i = m; i < (int)(n); i++) #define rrep(i,m,n) for (int i = m; i > (int)(n); i--) using S = int; using F = int; S op(S a, S b){ return min(a, b); } S e(){ return inf; } S mapping(F f, S x){ return (f == inf ? x : f); } F composition(F f, F g){ return (f == inf ? g : f);} F id(){ return inf; } int main(){ int n,q; cin >> n >> q; lazy_segtree seg(n); vvi vec; rep(_,0,q){ int l,r,b; cin >> l >> r >> b; --l; vec.push_back({b,l,r}); } sort(vec.begin(),vec.end()); rep(i,0,q){ int b = vec[i][0],l = vec[i][1],r = vec[i][2]; seg.apply(l,r,b); } rep(i,0,q){ int b = vec[i][0],l = vec[i][1],r = vec[i][2]; if (seg.prod(l,r) != b){ cout << -1 << endl; return 0; } } rep(i,0,n){ if (seg.get(i) == inf) cout << 1; else cout << seg.get(i); if (i != n-1){ cout << " "; } } cout << endl; }