t = int(raw_input())

for _ in xrange(t):
    a, b, c = map(int, raw_input().split())
    ans = 0
    last_pick = min(2 * b, c - 1 if c % 2 else c)
    ans += (last_pick + last_pick/2)
    b -= (last_pick/2)
    first_pick = min(2 * a, b - 1 if b % 2 else b)
    print ans + first_pick + first_pick/2
