The mayor of your city has decided to throw a party to gather the favour of his people in different regions of the city. 

There are 3 distinct regions in the city namely A, B, C comprising of P_{A}, P_{B} and P_{C} number of people respectively. 

However, the mayor knows that people of the region B are in conflict with people of regions A and C. So, there will be a conflict if people from region B are present at the party along with people from region A or C. 

The mayor wants to invite as many people as possible and also avoid any conflicts. Help him invite maximum number of people to the party.

------ Input Format ------ 

- The first line contains a single integer T - the number of test cases. Then the test cases follow.
- The first line of each test case contains three integers P_{A}, P_{B} and P_{C} - number of people living in regions A, B and C respectively. 

------ Output Format ------ 

For each test case, output the maximum number of people that can be invited to the party.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ P_{A}, P_{B}, P_{C} ≤ 1000$

----- Sample Input 1 ------ 
3
2 3 4
1 5 2
8 8 8

----- Sample Output 1 ------ 
6
5
16

----- explanation 1 ------ 
Test case-1: Mayor can invite all the people from region $A$ and $C$. So the maximum number of people invited is $6$.

Test case-2: Mayor can invite all the people from region $B$. So the maximum number of people invited is $5$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	print(max(b, a + c))


T = int(input())
for i in range(T):
	(Pa, Pb, Pc) = [int(j) for j in input().split()]
	if Pa + Pc > Pb:
		print(Pa + Pc)
	else:
		print(Pb)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(max(a + c, b))


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	if a + c > b:
		print(a + c)
	else:
		print(b)


for i in range(int(input())):
	(pa, pb, pc) = map(int, input().split())
	print(max(pa + pc, pb))


T = int(input())
for _ in range(T):
	(A, B, C) = map(int, input().split())
	R = max(A + C, B)
	print(R)


for i in range(int(input())):
	(A, B, C) = map(int, input().split())
	if A + C > B:
		print(A + C)
	else:
		print(B)


T = int(input())
for _ in range(T):
	(Pa, Pb, Pc) = map(int, input().split())
	if Pa + Pc >= Pb:
		print(Pa + Pc)
	else:
		print(Pb)


n = int(input())
for i in range(n):
	(a, b, c) = list(map(int, input().split()))
	if a + c > b:
		print(a + c)
	else:
		print(b)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a == b and b == c:
		print(a + c)
	elif a + c > b:
		print(a + c)
	else:
		print(b)


T = int(input())
for i in range(T):
	(PA, PB, PC) = map(int, input().split())
	print(max(PA + PC, PB))


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	if y > x + z:
		print(y)
	else:
		print(x + z)


def code():
	cases = int(input())
	for _ in range(cases):
		(pa, pb, pc) = map(int, input().split(' '))
		print(max(pa + pc, pb))
code()


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a + c >= b:
		print(a + c)
	else:
		print(b)


t = int(input())
while t:
	t -= 1
	(a, b, c) = map(int, input().split())
	if a + c > b:
		print(a + c)
	else:
		print(b)


T = int(input())
for i in range(T):
	(a, b, c) = map(int, input().split())
	n1 = a + c
	if n1 > b:
		print(n1)
	elif n1 < b:
		print(b)
	else:
		print(b)


for i in range(int(input())):
	(X, Y, Z) = map(int, input().split())
	if X + Z > Y:
		print(X + Z)
	else:
		print(Y)


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	x = a + c
	print(max(x, b))


t = int(input())
for i in range(t):
	(n, k, x) = map(int, input().split())
	if n + x >= k:
		print(n + x)
	else:
		print(k)


T = int(input())
for i in range(T):
	(A, B, C) = map(int, input().split())
	X = A + C
	print(max(X, B))


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	a = x + z
	print(max(a, y))


for _ in range(int(input())):
	(pa, pb, pc) = map(int, input().split())
	if pa + pc > pb:
		print(pa + pc)
	else:
		print(pb)


t = int(input())
for i in range(t):
	(Pa, Pb, Pc) = map(int, input().split())
	if Pa + Pc >= Pb:
		print(Pa + Pc)
	else:
		print(Pb)


t = int(input())
for i in range(t):
	(pa, pb, pc) = map(int, input().split())
	if pa + pc >= pb:
		print(pa + pc)
	else:
		print(pb)


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	print(max(x + z, y))


T = int(input())
for i in range(T):
	(Pa, Pb, Pc) = list(map(int, input().split()))
	if Pa + Pc > Pb:
		print(Pa + Pc)
	else:
		print(Pb)


t = int(input())
for i in range(t):
	(p1, p2, p3) = map(int, input().split())
	if p2 > p1 + p3:
		print(p2)
	else:
		print(p1 + p3)


N = int(input())
while N > 0:
	(a, b, c) = map(int, input().split())
	if a + c > b:
		print(a + c)
	else:
		print(b)
	N = N - 1


for _ in range(int(input())):
	(A, B, C) = map(int, input().split(' '))
	s = A + C
	print(max(s, B))


try:
	t = int(input())
	for r in range(t):
		(a, b, c) = map(int, input().split())
		x = a + c
		print(max(x, b))
except:
	pass


n = int(input())
for _ in range(n):
	(x1, x2, x3) = map(int, input().split())
	s = x1 + x3
	if x2 >= s:
		print(x2)
	elif x2 < s:
		print(s)


N = int(input())
for i in range(0, N):
	(A, B, C) = map(int, input().split())
	if B > A + C:
		max_sum = B
	else:
		max_sum = A + C
	print(max_sum)