#include #include using namespace std; using namespace atcoder; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() const long long MOD = 998244353; //const long long INF = 9*1e18; using ll = long long; using mint = modint998244353; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b>N>>Q; vector v; v.assign(N,INF); lazy_segtree seg(v); vector> A(Q); rep(i,Q){ ll a,b,c; cin>>a>>b>>c; a--; A[i] = {c,a,b}; } sort(all(A)); rep(i,Q){ seg.apply(get<1>(A[i]),get<2>(A[i]),get<0>(A[i])); } bool d = 0; rep(i,Q){ if(seg.prod(get<1>(A[i]),get<2>(A[i])) != get<0>(A[i])){ d = 1; } } if(d){ cout << -1 << endl; } else{ rep(i,N-1){ if(seg.get(i) == INF){ cout << INF-1 << " "; } else{ cout << seg.get(i) << " "; } } cout <