题目描述
Vishesh has gone to watch the new Spider-Man movie, but he is having troubles choosing which Popcorn-and-Coke combo to buy.
There are three combos A, B, and C available at the counter. You are given the time (in minute) for which each Popcorn bucket and Coke cup lasts. Given that Vishesh's satisfaction from a combo is defined as the total lasting time (in minute) of the Popcorn bucket and the Coke cup, find the maximum satisfaction he can get by buying a single combo.
------ Input Format ------
- The first line of each input contains T - the number of test cases. The test cases then follow.
- The first line of each test case contains two space-separated integers A_{1} and A_{2}, meaning that for combo A, the Popcorn bucket lasts A_{1} minutes and the Coke cup lasts A_{2} minutes.
- The second line of each test case contains two space-separated integers B_{1} and B_{2}, meaning that for combo B, the Popcorn bucket lasts B_{1} minutes and the Coke cup lasts B_{2} minutes.
- The third line of each test case contains two space-separated integers C_{1} and C_{2}, meaning that for combo C, the Popcorn bucket lasts C_{1} minutes and the Coke cup lasts C_{2} minutes.
------ Output Format ------
For each test case, output on a single line the maximum satisfaction Vishesh can get.
------ Constraints ------
$1 ≤ T ≤ 1000$
$1 ≤ A_{1}, A_{2}, B_{1}, B_{2}, C_{1}, C_{2} ≤ 10^{9}$
----- Sample Input 1 ------
3
3 6
5 10
8 7
99 1
55 55
33 51
54 146
5436 627
1527 5421
----- Sample Output 1 ------
15
110
6948
----- explanation 1 ------
- Test case $1$:
- For combo $A$, the Popcorn bucket lasts $3$ minutes, and the Coke cup lasts $6$ minutes, so Vishesh gets a satisfaction of $3 + 6 = 9$ if he buys this combo.
- For combo $B$, the Popcorn bucket lasts $5$ minutes, and the Coke cup lasts $10$ minutes, so Vishesh gets a satisfaction of $5 + 10 = 15$ if he buys this combo.
- For combo $C$, the Popcorn bucket lasts $8$ minutes, and the Coke cup lasts $7$ minutes, so Vishesh gets a satisfaction of $8 + 7 = 15$ if he buys this combo.
Therefore Vishesh's maximum satisfaction is $15$.
输入格式
见题面
输出格式
见题面