def consumirC(b, x):
    c = x // 2
    b -= c 
    if b < 0:
        return 0
    return b

def main():
    t = int(input())
    for _ in range(t):
        a, b, c = [int(i) for i in input().split(' ')]
        res = 0
        if b == 0:
            print(0)
            continue

        auxb = consumirC(b, c)
        if(auxb % 2 != 0):
            auxb += 1
        
        auxc = (b - auxb)
        res += auxc * 2 # consumindo c
        res += auxb//2 # consumindo a   
        res += auxb + auxc #consumindo b 
                
        print(res)

if __name__ == '__main__':
    main()
 	 		  		    			 		  							