#Qua2204. Game Theory

Game Theory

Description

Libra and Rahn are playing a game.

Libra has a non-negative integer AA and Rahn has a non-negative integer BB. Libra wants to take several steps to change AA to BB. Each step Libra can take one of the following operations:

  • Add 11 to AA (AA+1A\to A+1).
  • Multiply AA by 22 (A2AA \to 2A).
  • Divide AA by 22 (AA2A \to \frac{A}{2}). Note that Libra can take this operation only if AA is even.

Libra wants to know the minimum steps to change AA to BB using the operations above.

Format

Input

The first line contains one integer T(1T10000)T(1\le T\le 10000) -- the number of test cases.

For each test case there is a single line contains two integers A,B(1A,B1018)A,B(1\le A,B\le 10^{18}).

Output

For each test case, output a line with an integer representing the minimum steps Libra needs to take.

Samples

6
31 13
12 8
25 6
10 24
1 1
997 120
8
3
8
3
0
20