T=int(input()) for tests in range(T): A,B,C=map(int,input().split()) ANS=0 MIN=min(A,C) ANS+=2*MIN A-=MIN C-=MIN ANS+=2*(B//2) B-=B//2 ANS+=C//2 C-=C//2 MIN=min(A,B) ANS+=MIN A-=MIN B-=MIN print(ANS)