T=int(raw_input())

for i in range (0,T):
  s=raw_input()
  s=s.split(" ")
  a=int(s[0])
  b=int(s[1])
  c=int(s[2])

  if(c>=2*b):
    print(3*b)
  else:
    tot=c+c//2 -c%2
    b=b-c//2
    tot=tot+b+b//2-b%2
    print(tot)