import sys input = sys.stdin.readline from collections import * for _ in range(int(input())): A, B, C = map(int, input().split()) cnt02 = min(A, C) ans = 2*cnt02 A -= cnt02 C -= cnt02 ans += C//2 ans += B//2*2 if A>0 and B%2==1: ans += 1 print(ans)