n = int(input())
for i in range(n):
	a , b , c = list(map(int,input().split()))
	p = []
	count = 0
	while b>=1 and c>1:
		c = c-2
		p.append(2)
		b = b-1
		p.append(1)
	while a>0 and b>1:
		b = b-2
		p.append(2)
		a = a-1
		p.append(1)
	for j in range(len(p)):
		count += p[j]
	print(count)