Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift is forbidden if it cuts off some ones. So, in fact, in one operation, you can multiply or divide your number by $2$, $4$ or $8$, and division is only allowed if the number is divisible by the chosen divisor. 

Formally, if the register contains a positive integer $x$, in one operation it can be replaced by one of the following:   $x \cdot 2$  $x \cdot 4$  $x \cdot 8$  $x / 2$, if $x$ is divisible by $2$  $x / 4$, if $x$ is divisible by $4$  $x / 8$, if $x$ is divisible by $8$ 

For example, if $x = 6$, in one operation it can be replaced by $12$, $24$, $48$ or $3$. Value $6$ isn't divisible by $4$ or $8$, so there're only four variants of replacement.

Now Johnny wonders how many operations he needs to perform if he puts $a$ in the register and wants to get $b$ at the end.


-----Input-----

The input consists of multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 1000$) — the number of test cases. The following $t$ lines contain a description of test cases.

The first and only line in each test case contains integers $a$ and $b$ ($1 \leq a, b \leq 10^{18}$) — the initial and target value of the variable, respectively.


-----Output-----

Output $t$ lines, each line should contain one integer denoting the minimum number of operations Johnny needs to perform. If Johnny cannot get $b$ at the end, then write $-1$.


-----Example-----
Input
10
10 5
11 44
17 21
1 1
96 3
2 128
1001 1100611139403776
1000000000000000000 1000000000000000000
7 1
10 8

Output
1
1
-1
0
2
2
14
0
-1
-1



-----Note-----

In the first test case, Johnny can reach $5$ from $10$ by using the shift to the right by one (i.e. divide by $2$).

In the second test case, Johnny can reach $44$ from $11$ by using the shift to the left by two (i.e. multiply by $4$).

In the third test case, it is impossible for Johnny to reach $21$ from $17$.

In the fourth test case, initial and target values are equal, so Johnny has to do $0$ operations.

In the fifth test case, Johnny can reach $3$ from $96$ by using two shifts to the right: one by $2$, and another by $3$ (i.e. divide by $4$ and by $8$).

Difficulty: interview

Starter code:

Solutions:
ans = []
for _ in range(int(input())):
    a, b = list(map(int, input().split()))
    a, b = max(a, b), min(a, b)
    if a % b != 0:
        ans.append(-1)
        continue
    x = a // b
    cnt = 0
    while x % 2 == 0:
        x //= 2
        cnt += 1
    if x != 1:
        ans.append(-1)
        continue
    ansi = (cnt - 1) // 3 + 1
    ans.append(ansi)
print('\n'.join(map(str, ans)))


import sys
import math
#import random
#sys.setrecursionlimit(100000000)
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(list(map(int,input().split())))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

t=inp()

for _ in range(t):
	a,b=invr()
	
	if a<b:
		a,b=b,a
	
	if a%b:
		print(-1)
		continue
	
	ans=0
	
	a//=b
	
	while a%8==0:
		a//=8
		ans+=1
	while a%4==0:
		a//=4
		ans+=1
	
	while a%2==0:
		a//=2
		ans+=1
	
	if a!=1:
		print(-1)
	else:
		print(ans)
		
			

	


import math
t=int(input())
for you in range(t):
    l=input().split()
    a=int(l[0])
    b=int(l[1])
    if(a>b):
        a,b=b,a
    if(b%a!=0):
        print(-1)
    else:
        z=b//a
        if(z&(z-1)):
            print(-1)
        else:
            pow=0
            while(z>0):
                z=z//2
                pow+=1
            pow=pow-1
            print(math.ceil(pow/3))


for _ in range(int(input())):
    n, m = map(int, input().split())
    if n < m:
        n, m = m, n
    if n % m == 0:
        x = n // m
        b = 0
        while x % 2 == 0:
            x //= 2
            b += 1
        if x != 1:
            print(-1)
        else:
            print((b + 2) // 3)
    else:
        print(-1)

from math import ceil
for _ in range(int(input())):
    a, b = list(map(int, input().split()))
    bia = bin(a)[2:]
    bib = bin(b)[2:]
    aa = bia.strip('0')
    sca = len(bia) - len(aa)
    bb = bib.strip('0')
    scb = len(bib) - len(bb)
    if aa != bb:
        print(-1)
    else:
        print(ceil(abs(sca - scb)/3) )


from math import log

t = int(input())
for _ in range(t):
    a, b = sorted(map(int, input().split()))
    if b % a != 0:
        print(-1)
        continue
    q = b // a
    ops = round(log(q, 2))
    if 2**ops != q:
        print(-1)
        continue
    print((ops + 2) // 3)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
  a, b = map(int, input().split())
  if a > b: a, b = b, a
  res = 0
  while a < b:
    if a * 8 <= b: a *= 8
    elif a * 4 <= b: a *= 4
    else: a *= 2
    res += 1
  if a == b: print(res)
  else: print(-1)

import sys
#sys.stdin.readline()
#n = int(sys.stdin.readline())
k = int(sys.stdin.readline())
ans = []
for kek in range(k):
    (a, b) = map(int, sys.stdin.readline().split())
    if a == b:
        ans.append(0)
        continue
    if b > a:
        (a, b) = (b, a)
    kek = 0
    while a % 8 == 0 and a//8 >= b:
        a //= 8
        kek += 1
    while a % 4 == 0 and a//4 >= b:
        a //= 4
        kek += 1
    while a % 2 == 0 and a//2 >= b:
        a //= 2
        kek += 1
    if a != b:
        ans.append(-1)
    else:
        ans.append(kek)
print(*ans,sep='\n')

t = int(input())

for _ in range(t):
    a, b = list(map(int, input().strip().split()))
    a, b = min(a, b), max(a, b)
    if b % a != 0:
        print(-1)
    else:
        cnt = 0
        while a < b:
            a *= 2
            cnt += 1
        if a > b:
            print(-1)
        else:
            result = cnt // 3
            if cnt % 3 >= 1:
                result += 1
            print(result)


for case in range(int(input())):
    a, b = [int(x) for x in input().split()]

    s = 0
    while a * 8 <= b:
        a *= 8
        s += 1
    while a * 4 <= b:
        a *= 4
        s += 1
    while a * 2 <= b:
        a *= 2
        s += 1

    while a % 8 == 0 and a // 8 >= b:
        a //= 8
        s += 1
    while a % 4 == 0 and a // 4 >= b:
        a //= 4
        s += 1
    while a % 2 == 0 and a // 2 >= b:
        a //= 2
        s += 1

    if a == b:
        print(s)
    else:
        print(-1)


from collections import defaultdict as dd
import math
import sys
import string
input=sys.stdin.readline
def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return list(map(int, input().split()))

def lm():
	return list(map(int, input().split()))

q=nn()
for _ in range(q):
	a,b = mi()

	small= min(a,b)
	big = max(a,b)
	ops=0
	while small<big:
		small*=2
		ops+=1
	if small==big:
		print((ops+2)//3)
	else:
		print(-1)


from sys import stdin,stdout
T=int(stdin.readline().strip())
#n=int(stdin.readline().strip())
for caso in range(T):
    
    a,b=list(map(int,stdin.readline().strip().split()))
    ans=0
    while a>b:
        if a%8==0 and a//8>=b:
            a=a//8
            ans+=1
        elif a%4==0 and a//4>=b:
            a=a//4
            ans+=1
        elif a%2==0 and a//2>=b:
            a=a//2
            ans+=1
        else:
            break
    while  a<b:
        if a*8<=b:
            a=a*8
            ans+=1
        elif a*4<=b:
            a=a*4
            ans+=1
        elif a*2<=b:
            a=a*2
            ans+=1
        else:
            break
    if a==b:
        print(ans)
    else:
        print(-1)
#s=list(map(int,stdin.readline().strip().split()))


for _ in range(int(input())):
    a,b = map(int,input().split())
    if(b<a):
        a,b = b,a
    i=0
    while(a!=b):
        if(8*a<=b):
            a*=8
            i+=1
        elif(4*a<=b):
            a*=4
            i+=1
        elif(2*a<=b):
            a*=2
            i+=1
        else:
            i=-1
            break
    print(i)

for i in range(int(input())):
    a,b=map(int,input().split())
    m=0
    l=0
    while a%2==0:
        a//=2
        m+=1
    while b%2==0:
        b//=2
        l+=1
    if b!=a:
        print(-1)
    else:
        u=abs(l-m)
        if u%3!=0:
            print(u//3+1)
        else:
            print(u//3)

import sys
def I():
    return sys.stdin.readline().rstrip()

for tc in range(1, 1 + int(I())):
    a, b = list(map(int, I().split()))
    al, bl = 0, 0
    while a > 0 and a % 2 == 0:
        al += 1
        a //= 2
    while b > 0 and b % 2 == 0:
        bl += 1
        b //= 2
    if a == b:
        d = abs(al-bl)
        print((d+2)//3)
    else:
        print(-1)



T = int(input())

def solve():
    [A,B] = list(map(int,input().split()))
    def helper(A,B):
        count = 0
        while A != B:
   #         print(A,B)
            if A > B:
                return False
            if 8*A <= B:
                A *= 8
                count += 1
            elif 4*A <= B:
                A *= 4
                count += 1
            elif 2*A <= B:
                A *= 2
                count += 1
            else:
                return -1
        return count

    return helper(min(A,B),max(A,B))



for _ in range(T):
    print(solve())


# from decorators import *
from sys import stdin, stdout
from math import ceil

# @debug
def solve(a,b):
    x = max(a,b)
    y = min(a,b)
    c = 0
    while x!=y:
        if x%2:
            print(-1)
            return True
        c+=1
        x //= 2
    print(ceil(c/3)) 
    return True

for _ in range(int(input())):
    n,m = map(int,stdin.readline().split())
    solve(n,m)

from collections import *
t = int(input())
for i in range(t):
	a,b = list(map(int,input().split()))
	ct = 0
	if(a > b):
		while(a%2 == 0 and a > b):
			a //= 2
			ct += 1
		if(a != b):
			print(-1)
			continue
		ans = ct//3 + (ct%3)//2 + (ct%3)%2
		print(ans)
	else:
		while(a < b):
			a *= 2
			ct += 1
		if(a != b):
			print(-1)
			continue
		ans = ct//3 + (ct%3)//2 + (ct%3)%2
		print(ans)