I,L,P=input,len,print t=int(I()) for _ in range(t): a,b=map(int,I().split());l,r,C=[],[],0 while a