import Data.List
import Control.Monad
import Control.Applicative

solve' :: String -> String -> String
solve' a b =
	let ns = map read $ words a :: [Int]
	    ms = map read $ words b :: [Int]
	    h  = length $ filter id $ zipWith (==) ns ms
	    m  = (length $ filter (\c -> c `elem` ns) ms) - h
	in (show h) ++ " " ++ (show m)

solve :: [String] -> [String]
solve [] = []
solve (a:b:cs) = (solve' a b) : (solve cs)
	
main :: IO ()
main = do
	ls <- fmap lines getContents
	mapM_ putStrLn $ solve ls