#include using namespace std; int main(){ int N,Q; cin>>N>>Q; vector>> query(N,vector>(0,vector(2))); for(int i=0;i>l>>r>>B; vector temp={r,B}; query[l-1].emplace_back(temp); } vector ans(N); priority_queue,vector>,function,vector)>> q([](vector a,vector b){ return a[1] v:query[i]){ q.push(v); } while(!q.empty() && q.top()[0]-1> m; for(int i=0;i v:query[i]){ if(lower_bound(m[v[1]].begin(),m[v[1]].end(),i)==lower_bound(m[v[1]].begin(),m[v[1]].end(),v[0])){ cout<<-1<