I. Cossack Vus and the Treasures
Kozak Vus decided to buy gifts for his friends. During his shopping trip, he encountered a unique promotion: solve a problem and receive any item for free.
There are boxes numbered from to , arranged in a circle. This means boxes and are adjacent for , and boxes and are also adjacent. Some of these boxes contain hidden treasures! You can make queries any number of times to gather information.
Query descriptions:
Determine the parity (even or odd) of the total number of treasures in any three different boxes.
Determine the parity of the total number of treasures in any three consecutive boxes.
Kozak Vus needs to find out:
The minimum number of queries of type (1) required to ensure you can determine whether the total number of treasures is even or odd.
The minimum number of queries of type (2) required to ensure you can determine whether the total number of treasures is even or odd.
Help Kozak Vus solve this problem quickly, as the items are disappearing with each passing minute!
Input
The input consists of several (at least one) test cases.
The first line contains a single integer () — the number of test cases.
Each of the next lines contains two integers and ().
Output
Output lines. The -th line should contain a single integer , where is the answer to question number of the -th test case accordingly.
Examples
Note
In the second test case, it is sufficient to make the following queries: , , , and .
In the third test case, the following queries need to be made: , , .
Scoring
If the solution works correctly only for , where is a positive integer, it will be scored at points.
If the solution works correctly only for , it will be scored at points.
If the solution works correctly only for , it will be scored at points.