We’re preparing your current view and syncing the latest data.
You have two types of beans: red and blue. You want to arrange them into containers such that each container contains beans of only one color, and no two adjacent containers contain the same color of beans. Given the number of red beans R and blue beans B, find the minimum number of containers needed.
The first line contains an integer T, the number of test cases. Each test case contains two integers R and B representing the number of red and blue beans.
For each test case, output a single integer — the minimum number of containers required.
1 ≤ T ≤ 1000; 1 ≤ R, B ≤ 100
Example 1
Input
3 2 2 3 1 1 5
Output
1 2 2
Explanation
For the first test case, all beans can be placed in one container. In the second, beans must be split into two containers to alternate colors. In the third, the containers are arranged to separate blue beans so that no two adjacent containers have the same color.