ACMT  Acm Teams
Engineer ahmed sror one of the best coches, He picks team members by using two ways.
First one that the optimal team of three people should consist of one experienced participant and two newbies. Thus, each experienced participant can share the experience with a large number of people.
Second one that the optimal team should have two experienced members plus one newbie. Thus, each newbie can gain more knowledge and experience.
All the teams during the training session should belong to one of the two ways described above. Furthermore,they agree that the total number of teams should be as much as possible.
There are E experienced members and N newbies on the training session.Can you calculate what maximum number of teams can be formed?
Input
The first line of the input contains a single integer corresponding to number of test cases t (1 ≤ t ≤ 10) ,The second line contains two integers E and N (0 ≤ E, N ≤ 5·10^{5}) — the number of experienced participants and newbies that are present at the training session.
Output
For each test case print a single integer representing the maximum number of teams that can be formed.
Example
Input: 2 2 6 4 5 Output: 2 3
Note Let's represent the experienced players as XP and newbies as NB.
In the first test the teams look as follows: (XP, NB, NB), (XP, NB, NB).
In the second test sample the teams look as follows: (XP, NB, NB), (XP, NB, NB), (XP, XP, NB).
hide comments
Neeraj Joshi:
20150901 18:16:35
AC in one go.......


shantanu tripathi:
20150823 13:48:57
greedy :d tutorials .. 

Vishesh Middha:
20150820 14:41:47
please provide some more test cases 

Abhay Jain:
20150820 10:12:54
Got it! Stupid error... :) Last edit: 20150820 10:18:36 

:.Mohib.::
20150814 15:28:19
Greedy ;) 

Sarthak Taneja:
20150802 12:06:52
My 200th :P ... 

Satyam Mishra:
20150730 23:19:50
hell easy :) 

mrx:
20150711 13:09:28
no algos no dp nothing, all hit and trial. 

vasayashwanth:
20150711 08:04:30
dead easy 

kp:
20150625 12:14:42
This will be the most solved problem in one year : 
Added by:  atef 
Date:  20150423 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 