import Control.Monad

main :: IO ()
main = do
  q <- readLn
  ls <- replicateM q getLine
  let ls' = map (map read . words) ls
  mapM_ print $ solve ls'

solve :: [[Int]] -> [Int]
solve = map count
  where
    count :: [Int] -> Int
    count [c,a,n]
      | all (1 <= ) [c,a,n] = 1 + (count [c-1,a-1,n-1])
      | c >= 2 && a >= 1 = 1 + (count [c-2,a-1,n])
      | c >= 3 = 1 + (count [c-3,a,n])
      | otherwise = 0
      