t=int(input())
while(t>0):
    a,b,c=input().split()
    b=int(b)
    a=int(a)
    c=int(c)
    count=0
    count1=0
    answer=0
    if(b==0):
        print(0)
    else:
        while(b>0 and c>1):
            c=c-2
            count=count+1
            b=b-1
        answer=answer+count*2+count
        while(b>1 and a>0):
            b=b-2
            count1=count1+1
            a=a-1
        answer=answer+count1*2+count1
        print(answer)
    t=t-1
    
