main :: IO ()
main = getContents >>= loop . map (map read . words) . lines
  where loop [] = return ()
        loop (as:bs:rs) = do
          printResult $ solve as bs
          loop rs

        printResult (h, b) = putStrLn $ show h ++ " " ++ show b

solve :: [Int] -> [Int] -> (Int, Int)
solve as bs = foldl f (0, 0) $ zip as bs
  where f hb@(h, b) (ai, bi)
          | ai == bi      = (h + 1, b)
          | bi `elem` as  = (h, b + 1)
          | otherwise     = hb