J. MrMoon's Gaming Setup
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

MrMoon is organizing a massive competitive programming and gaming tournament.

To set up the gaming stations, he needs to assemble complete gamepads. A complete gamepad set consists of exactly one Left Controller and exactly one Right Controller.Currently, MrMoon has counted $$$x$$$ Left Controllers and $$$y$$$ Right Controllers in his inventory.

Determine the maximum number of complete gamepad sets MrMoon can assemble for the tournament.

Input

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases.

Each test case consists of a single line containing two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 10^{18}$$$) — the number of Left Controllers and the number of Right Controllers, respectively.

Output

For each test case, output a single integer — the maximum number of complete gamepad sets possible.

Example
Input
4
5 3
10 10
0 5
1000000000000000000 999999999999999999
Output
3
10
0
999999999999999999