import Control.Applicative ((<$>))

type Hands = [String]
type Points = [Int]

main = do
    n <- read <$> getLine
    hs <- map words <$> replicateM n getLine
    putStrLn . unwords $ show <$> cardGame hs

cardGame :: [Hands] -> Points
cardGame hs = foldr1 (\x acc -> zipWith (+) x acc) $ map oneGame hs

oneGame :: Hands -> Points
oneGame [a,b]
    | result == LT = [0,3]
    | result == EQ = [1,1]
    | result == GT = [3,0]
    where result = a `compare` b