import Control.Applicative
import Data.List

main = do
  contents <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
  let ans = fmap solve $ makeTuple contents []
  mapM_ output ans

makeTuple :: [[Int]] -> [([Int], [Int])] -> [([Int], [Int])]
makeTuple [] s = s
makeTuple all@(x:[]) s = s
makeTuple (x:y:ys) s = (x, y):makeTuple ys s

solve :: ([Int], [Int]) -> (Int, Int)
solve (x, y) = let hit = hitCount x y
                   blow = (blowCount x y) - hit
                     in (hit, blow)

hitCount :: [Int] -> [Int] -> Int
hitCount x y = length $ findIndices (== True) $ zipWith (==) x y

blowCount :: [Int] -> [Int] -> Int
blowCount x y = length $ findIndices (== True) $ fmap (\a -> elem a y) x

output :: (Int, Int) -> IO ()
output (x, y) = putStrLn $ (show x) ++ " " ++ (show y)