def f(): a,b,c=map(int,input().split()) ans=0 d1=min(a,c) ans=d1*2 a-=d1 c-=d1 ans+=b//2*2+c//2*2 b=b%2 ans+=min(a,b) print(ans) m=int(input()) for _ in range(m): f()