import java.util.*;
public class Solution{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        for(int i=0;i<t;i++){
            int a=s.nextInt();
            int b=s.nextInt();
            int c=s.nextInt();
            int count=0;
            if(a>0 && b>0){
                int g=c/2;
                for(int j=0;j<g;j++){
                    count=count+2;
                    b=b-1;
                    count=count+1;
                }
                if(b>0){
                    int g1=b/2;
                    for(int j1=0;j1<g1;j1++){
                    count=count+2;
                    a=a-1;
                    count=count+1;
                }
                }
                System.out.println(count);
            }
            else{
                count=0;
                System.out.println(count);
            }
        }
    }
   
}