t = int(input())
while(t):
    t -= 1
    a, b, c = map(int, input().split())
    ans = 0
    d = min(c - c%2, 2*b)
    ans += d + d//2
    b -= d//2
    d = min(b - b%2, 2*a)
    ans += d + d//2
    print(ans)
