A student dreamt that he walked along the town where there were lots of pubs. He drank a mug of ale in each pub. All the pubs were numbered with positive integers and one could pass from the pub number n to the pub with a number that divides n. The dream started in the pub number a. The student knew that he needed to get to the pub number b. It’s understood that he wanted to drink on the way as much ale as possible. If he couldn’t get from the pub number a to the pub number b he woke up immediately in a cold sweat.
Input
The first line contains an integer T — an amount of tests. Then T lines with integers a and b follow (0 ≤ T ≤ 20; 1 ≤ a, b ≤ 109).
Output
For each test in a separate line you are to output the maximal number of mugs that the student could drink on his way.
Sample
input | output |
---|
5
30 89
2 16
3 243
1 1
2 2
| 0
4
5
1
1
|
Problem Author: Aleksandr Bikbaev
Problem Source: USU Junior Championship March'2005