JIXMPII5JUkT7UV#'?/

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Statement

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 2 , 4 4 or 8 8 , and division is only allowed if the number is divisible by the chosen divisor.

Formally, if the register contains a positive integer x x , in one operation it can be replaced by one of the following:

  • x2 x \cdot 2
  • x4 x \cdot 4
  • x8 x \cdot 8
  • x/2 x / 2 , if x x is divisible by 2 2
  • x/4 x / 4 , if x x is divisible by 4 4
  • x/8 x / 8 , if x x is divisible by 8 8

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

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

Format

Input

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

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

Output

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

Sample

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

ShanghaiTech ACM 炸鱼杯

未参加
状态
已结束
规则
OI
题目
46
开始于
2024-12-10 23:00
结束于
2024-12-15 13:00
持续时间
110 小时
主持人
参赛人数
112