testCase = int(input())
 
for i in range(testCase):
    n = [int(x) for x in input().split()]
    pair = 0
    if n[1]%2==0: 
        pair += n[1]
    else:
        pair += n[1] - 1
 
    if n[2]%2==0: 
        pair += n[2]
    else:
        pair += n[2] - 1
 
    div = n[0]*2
    if div<pair:
        print(n[0]+div)
    else:
        p = pair//2
        print(p+pair)


 	 		   			 	       			 		 	  	