#include #include #include #include using namespace std; long long readInt(long long l,long long r,char endd){ long long x=0; int cnt=0; int fi=-1; bool is_neg=false; while(true){ char g=getchar(); if(g=='-'){ assert(fi==-1); is_neg=true; continue; } if('0'<=g && g<='9'){ x*=10; x+=g-'0'; if(cnt==0){ fi=g-'0'; } cnt++; assert(fi!=0 || cnt==1); assert(fi!=0 || is_neg==false); assert(!(cnt>19 || ( cnt==19 && fi>1) )); } else if(g==endd){ assert(cnt>0); if(is_neg){ x= -x; } if(!(l<=x && x<=r)){ cerr< rng[100100]; pair ppl[100100]; int sol[100100]; int main(){ //freopen("01.txt","r",stdin); //freopen("01o.txt","w",stdout); T=readIntLn(1,100); while(T--){ n=readIntSp(1,100000); m=readIntLn(1,100000); sm_n+=n; sm_m+=m; assert(sm_n<=300000); assert(sm_m<=300000); for(int i=0;i