t=int(input())
for i in range(t):
x,y=[int(j) for j in input().split()]
c=0
tmpx=x
if x>y:
c=-1
else:
while y>0:
if x<=y:
y=y-x
x*=2
else:
x=tmpx
if x>y:
c=-1
break
y=y-x
x*=2
c+=1
c+=1
print(c)
Why this code give wrong answer? Is there only one way to solve this problem.