import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for(int t = 0; t < T; t++){
            long A = sc.nextLong();
            long B = sc.nextLong();
            long C = sc.nextLong();
            long min = Math.min(A,C);
            long ans = B/2*2 + min*2;
            A -= min;
            B = B % 2;
            C -= min;
            if(A != 0){
                ans += B;
            }else if(C != 0){
                ans += C/2;
            }
            System.out.println(ans);
        }
    }
}