T = int(input()) for _ in range(T): A,B,C = map(int,input().split()) ans = 0 ans += + B - (B%2) B = B%2 if C <= A: A -= C ans += 2*C C = 0 else: print(ans+2*A) continue if B <= A: print(ans+B) continue else: print(ans+A) continue