#d2919. a 变为 b
a 变为 b
Changing a to b
Problem Description
You are given two integers and . You first choose a positive odd number and a positive even number (these remain fixed throughout the whole process). In each step you may choose one of the following:
- Let ;
- Let .
Find the minimum number of operations needed to turn into .
Input Format
The first line contains an integer .
Each of the next lines contains two integers .
Output Format
For each test case, output one line containing one integer — the minimum number of operations.
Sample Input
1
10 7
Sample Output
2