### main

qn = gets.strip.to_i

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

  can_n = [cn, an, nn].min
  cn -= can_n
  an -= can_n
  nn -= can_n

  cca_n = [cn / 2, an].min
  cn -= cca_n * 2
  an -= cca_n

  ccc_n = cn / 3

  puts (can_n + cca_n + ccc_n)
end