Problem:CodeChef: Practical coding for everyone
n=int(input())
for i in range(n):
a,b=map(int,input().split())
m=a
t=0
l=[]
if b%a!=0:
print(-1)
continue
while b>0:
if a>b:
break
if m<=b:
l.append(m)
t+=1
b-=m
m*=2
else:
m=a
t+=1
if b==0:
if len(l)>=2:
if l[-1]!=l[-2]:
print(t)
else:
print(-1)
else:
print(t)
else:
print(-1)
what is the wrong in this solution