#include #include //eolibraries #define lnf 3999999999999999999 #define inf 999999999+1 #define fi first #define se second #define pb push_back #define all(c) (c).begin(),(c).end() #define sz(c) (int)(c).size() #define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end()); #define rep(i,n) for(int i=0;i=0;i--) #define crep(i,x,n) for(int i=x;i #define _3E0svGb ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) //eodefine using namespace std; typedef long long ll; typedef long double ld; using pii=pair; using tpii=pair; using vi=vec(int); const int mxn=12000; ll op(ll l,ll r){ return min(l,r); } ll e(){ return lnf; } int main(){ _3E0svGb; int n,m; cin>>n>>m; atcoder::segtree seg(n); rep(i,n) seg.set(i,lnf); vec(vec(pii)) qry(n); ll mx=0; rep(i,m){ ll l,r,val; cin>>l>>r>>val; l--,r--; mx=max(mx,val); qry[r].pb({l,val}); } mx++; rep(i,n){ sort(all(qry[i])); for(auto p : qry[i]){ ll val=p.se; if(seg.prod(p.fi,i+1)