$stdin.gets.to_i.times do
  c,a,n = $stdin.gets.chomp.split(" ").map(&:to_i)
  numTeam = 0
  while n >= 1 && c >= 1 && a >= 1
    c -= 1
    a -= 1
    n -= 1
    numTeam += 1
  end
  while c >= 2 && a >= 1
    c -= 2
    a -= 1
    numTeam += 1
  end
  while c >= 3
    c -= 3
    numTeam += 1
  end
  p numTeam
end