import Control.Monad

main = do
  n <- readLn
  cards <- replicateM n $ fmap ((\(t:h:_) -> (t,h)) . words) getLine
  putStrLn . (\(t,h) -> (show t) ++ " " ++ (show h)) $ solve3 cards

data ResultOneGame = TWin | HWin | Draw deriving Show

compereDict ([],[]) = Draw
compereDict ([],_) = HWin
compereDict (_,[]) = TWin
compereDict ((t:ts), (h:hs)) = case t `compare` h of
                                 GT -> TWin
                                 LT -> HWin
                                 EQ -> compereDict (ts, hs)

solve3 :: [(String,String)] -> (Int,Int)
solve3 list = foldl f (0,0) list
  where
    f :: (Int,Int) -> (String, String) -> (Int,Int)
    f (tScore, hScore) (tCard, hCard) = case compereDict (tCard, hCard) of
                                         TWin -> (tScore+3, hScore)
                                         HWin -> (tScore, hScore+3)
                                         Draw -> (tScore+1, hScore+1)

