import Data.List

solve' :: Int -> [Int] -> [Int]	-> [Int] -> String
solve' _ _ [] hb = unwords $ map show hb
solve' n x (y:ys) [h,b]
  | elemIndex y x == Nothing = solve' (n+1) x ys [h,b]
  | elemIndex y x == Just n = solve' (n+1) x ys [h+1,b]
  | otherwise = solve' (n+1) x ys [h,b+1]

solve :: [[Int]] -> [String]
solve [] = []
solve (x:y:xs) = solve' 0 x y [0,0] : solve xs

main = getContents >>= putStr . unlines . solve . map (map read . words) . lines