import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.Char

f x y [] = [x, y]
f x y ([s,t] : ss)
  | s < t = f x (y+3) ss
  | s > t = f (x+3) y ss
  | otherwise = f (x+1) (y+1) ss

main = readLn >>= flip replicateM (words <$> getLine) >>= putStrLn . unwords . map show . f 0 0
    