GT and numbers

Time Limit: 1000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5505
64-bit integer IO format: %I64d      Java class name: Main

Description

You are given two numbers $N$ and $M$.

Every step you can get a new $N$ in the way that multiply $N$ by a factor of $N$.

Work out how many steps can $N$ be equal to $M$ at least.

If N can't be to M forever,print $-1$.

Input

In the first line there is a number $T$.$T$ is the test number.

In the next $T$ lines there are two numbers $N$ and $M$.

$T\leq1000$, $1\leq N \leq 1000000$,$1 \leq M \leq 2^{63}$.

Be careful to the range of M.

You'd better print the enter in the last line when you hack others.

You'd better not print space in the last of each line when you hack others.

Output

For each test case,output an answer.

Sample Input

3
1 1
1 2
2 4

Sample Output

0
-1
1

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .