#yuki2110 T = int(input()) def sol(a, b, c): res = 0 res += min(a,c)*2 res += 2*(b//2) b %= 2 m = min(a,c) a -= m c -= m if a > 0: res += b if c > 0: res += c//2 return res for _ in range(T): a, b, c = map(int, input().split()) print(sol(a,b,c))