//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #include <iostream> #include <algorithm> #include <atcoder/all> using namespace std; using namespace atcoder; using mint = modint1000000007; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using vvb = vector<vb>; using vm = vector<mint>; using vvm = vector<vm>; using vpi = vector<pii>; using vvpi = vector<vpi>; using vpl = vector<pll>; using vvpl = vector<vpl>; const int inf = 1e9; 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<S, op, e, F, mapping, composition, id> 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()); //reverse(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 << l << " " << r << " " << b << endl; cout << -1 << endl; return 0; } } rep(i,0,n){ cout << seg.get(i); if (i != n-1){ cout << " "; } } cout << endl; }