T=int(input()) for i in range(T): A,B,C=map(int,input().split()) res=0 x=min(A,C) res+=x*2+(B//2)*2 B%=2 A-=x C-=x y=min(A,B) res+=y+C//2 print(res)