import Control.Applicative

import Control.Monad
    (replicateM)
    
type Match = (String, String)

type Judge = (Int, Int)

type Problem = [Match]

type Result = Judge

judge :: Match -> Judge

judge (taro, hanako)
    | taro > hanako
        = (3, 0)
        
    | taro < hanako
        = (0, 3)
        
    | otherwise
        = (1, 1)
        
solve :: Problem -> Result

solve problem
    = foldl1 (\(t, h) (nt, nh) -> (t + nt, h + nh)) $ map judge problem

output :: Result -> String

output (taro, hanako)
    = show taro ++ " " ++ show hanako
    
input :: IO Problem

input
    = do
        n <- read <$> getLine
        replicateM n inputMatch
        
inputMatch :: IO Match

inputMatch
    = do
        [taro, hanako] <- words <$> getLine
        return (taro, hanako)

main :: IO ()

main
    = putStrLn.output =<< solve <$> input