def aa(m): while m>1: m//=2 seg[m]=max(seg[m*2],seg[m*2+1]) def bb(l,r): res=-1 while l