solve tp hp [] = show tp ++ " " ++ show hp
solve tp hp ([t,h]:xs)
	| t > h = solve (tp+3) hp xs
	| t < h = solve tp (hp+3) xs
	| otherwise = solve (tp+1) (hp+1) xs

main = getContents >>= putStrLn . solve 0 0 . map words . tail . lines