Monica and Rachel opposite to Chandler and Joey were fighting over the apartment. If Chandler and Joey solve this question, they will get Monica's apartment. So they need your help to solve the problem.
You have number of C's and number of S's.
You need to find the maximum number of "SCC" which can be formed from this.
Note : 2 C's Can form a S .
Input:
The first line of input contains the number of test cases.
The only line of each input contains the number of C's (a) and S's (b).
Output
Print the maximum number of words obtained
Constraints
1<=T<=10^6
1<=a,b<=10^18