import Control.Applicative
import Data.Function
import Control.Monad
import Data.List
import Data.Char
import Control.Monad.State

j :: [String] -> [Int]
j [t,h] = case compare t h of
            GT -> [3,0]
            LT -> [0,3]
            EQ -> [1,1]

main :: IO ()
main = do
    n <- readLn
    cards <- replicateM n $ words <$> getLine
    putStrLn $ unwords . map show . foldr1 (\[x,y] [ax,ay] -> [x+ax,y+ay]) . map j $ cards
