#define _USE_MATH_DEFINES #include using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template class LazySegmentTree{ int sz,height; vector data; vector lazy; const M m1; const N n1; M ref(int k){return g(data[k],lazy[k]);} void recalc(int k){while(k>>=1)data[k]=f(ref(2*k),ref(2*k+1));} void thrust(int k){for(int i=height;i>0;i--)eval(k>>i);} void eval(int k){ lazy[2*k]=h(lazy[2*k],lazy[k]); lazy[2*k+1]=h(lazy[2*k+1],lazy[k]); data[k]=ref(k); lazy[k]=n1; } public: LazySegmentTree(int n,const M &m1,const N n1):m1(m1),n1(n1){ sz=1,height=0; while(sz& v){ rep(i,0,v.size())data[i+sz]=v[i]; for(int k=sz-1;k>0;k--)data[k]=f(data[2*k],data[2*k+1]); } void set(int a,M x){thrust(a+=sz); data[a]=x; recalc(a);} void update(int a,int b,N x){ if(a>=b)return; thrust(a+=sz); thrust(b+=sz-1); for(int l=a,r=b+1;l>=1,r>>=1){ if(l&1)lazy[l]=h(lazy[l],x),++l; if(r&1)--r,lazy[r]=h(lazy[r],x); } recalc(a); recalc(b); } M query(int a,int b){ if(a>=b)return m1; thrust(a+=sz); thrust(b+=sz-1); M L=m1,R=m1; for(int l=a,r=b+1;l>=1,r>>=1){ if(l&1)L=f(L,ref(l++)); if(r&1)R=f(ref(--r),R); } return f(L,R); } }; int f(int a,int b){return min(a,b);} int g(int a,int b){return (b==inf/2?a:b);} int h(int a,int b){return (b==inf/2?a:b);} int main(){ int n,q; cin>>n>>q; LazySegmentTree seg(n,inf/2,inf/2); using T=array; vector a(q); rep(i,0,q){ cin>>a[i][1]>>a[i][2]>>a[i][0]; a[i][1]--; } sort(ALL(a)); for(auto& xyz:a){ seg.update(xyz[1],xyz[2],xyz[0]); } for(auto& xyz:a){ if(seg.query(xyz[1],xyz[2])!=xyz[0]){ puts("-1"); return 0; } } rep(i,0,n){ int ret=seg.query(i,i+1); cout<