from sys import stdin
input=lambda :stdin.readline()[:-1]

def solve():
  a,b,c=map(int,input().split())
  ans=0
  x=min(a,c)
  ans+=2*x
  c-=x
  a-=x
  
  ans+=2*(b//2)
  b%=2
  
  ans+=(c//2)
  
  if b>0 and a>0:
    ans+=1
  
  print(ans)

for _ in range(int(input())):
  solve()