for _ in range(int(input())): a, b, c = map(int, input().split()) x = min(a, c); a -= x; c -= x y = b//2; b %= 2 print(2*x+2*y+min(a, b)+c//2)