GT and numbers

Accepts: 47
Submissions: 939
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
Problem 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