


import java.util.*;
public class stones {
    public static void main(String[] args)
    {
        Scanner input=new Scanner(System.in);
        int t;
        t=input.nextInt();
        while(t!=0){
            t--;
        int a,b,c;
        a=input.nextInt();
        b=input.nextInt();
        c=input.nextInt();
        int maxi,ans;
        maxi=-1;
        ans=0;
        if(b==c)
        {
             while(c>=2 & b!=0)
            {
                c-=2;
                b--;
                ans+=3;
            }
            while(b>=2 & a!=0)
            {
                b-=2;
                a--;
                ans+=3;
            }
            System.out.println(ans);
            continue;
        }
        maxi=Math.max(b,c);
        System.out.println(maxi);
        if(maxi==b)
        {
            while(b>=2 & a!=0)
            {
                b-=2;
                a--;
                ans+=3;
            }
            while(c>=2 & b!=0)
            {
                c-=2;
                b--;
                ans+=3;
            }
            System.out.println(ans);
        }
        else
        {
             while(c>=2 & b!=0)
            {
                c-=2;
                b--;
                ans+=3;
            }
            while(b>=2 & a!=0)
            {
                b-=2;
                a--;
                ans+=3;
            }
            System.out.println(ans);
        }
        }
    }
}
