Problem A: Assistant

Problem A: Assistant

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 40  Solved: 12
[Submit] [Status] [Web Board] [Creator:]

Description

Bob likes to play games, circus, Super Mary and Snowman Brothers. These are all simple games Bob plays through customs. Now Bob wants to challenge some new game "assistant", which requires that the game can only be completed by players'assistants. As Bob's assistant, Alice can help Bob do a lot of things. It's incumbent on him to complete the game. The game is to help Mario save the princess. Alice has come to the last stage with a lot of hard work. There are two buttons and a monitor in the last stage. Blue button and red button can double a number. Red button can subtract one number. There are two numbers N and M on the display. After all, Bob is a professional gamer, so Bob wants Alice to turn the number N into the number M at least a few times.

Input



The first line of input contains an integer T(T≤100) indicating the number of test cases.

For each test case: The first line contains two integer N,M (1 <= N,M <= 10000)  

Output



For each test case output the ans. 


Sample Input Copy

4 6

Sample Output Copy

2