### main

qn = gets.strip.to_i

qn.times do
  cn, an, nn = gets.strip.split(' ').map{|s| s.to_i}

  teams = (0..cn).map{(0..an).map{(0..nn).map{0}}}

  for c0 in (0..cn)
    for a0 in (0..an)
      for n0 in (0..nn)
        t0 = teams[c0][a0][n0]
        ## CCA
        c1 = c0 + 2
        a1 = a0 + 1
        if c1 <= cn && a1 <= an && teams[c1][a1][n0] <= t0
          teams[c1][a1][n0] = t0 + 1
        end

        ## CCC
        c1 = c0 + 3
        if c1 <= cn && teams[c1][a0][n0] <= t0
          teams[c1][a0][n0] = t0 + 1
        end

        ## CAN
        c1 = c0 + 1
        a1 = a0 + 1
        n1 = n0 + 1
        if c1 <= cn && a1 <= an && n1 <= nn && teams[c1][a1][n1] <= t0
          teams[c1][a1][n1] = t0 + 1
        end
      end
    end
  end

  puts teams[cn][an][nn]
end