#P1031F. Familiar Operations
Familiar Operations
No submission language available for this problem.
Description
You are given two positive integers and . There are two possible operations:
- multiply one of the numbers by some prime ;
- divide one of the numbers on its prime factor .
What is the minimum number of operations required to obtain two integers having the same number of divisors? You are given several such pairs, you need to find the answer for each of them.
The first line contains a single integer () — the number of pairs of integers for which you are to find the answer.
Each of the next lines contain two integers and ().
Output lines — the -th of them should contain the answer for the pair , .
Input
The first line contains a single integer () — the number of pairs of integers for which you are to find the answer.
Each of the next lines contain two integers and ().
Output
Output lines — the -th of them should contain the answer for the pair , .
Samples
Note
These are the numbers with equal number of divisors, which are optimal to obtain in the sample test case:
- , 4 divisors
- , 9 divisors
- , 12 divisors
- , 2 divisors
- , 6 divisors
- , 6 divisors
- , 12 divisors
Note that there can be several optimal pairs of numbers.