main :: IO ()
main = getLine >> getContents >>= putStrLn . format . game . map words . lines
      where format (a, b) = show a ++ " " ++ show b

game :: [[String]] -> (Int, Int)
game [] = (0, 0)
game ([x, y]:xs)
    | x < y = (taro, hanako + 3)
    | x > y = (taro + 3, hanako)
    | otherwise = (taro + 1, hanako + 1)
    where (taro, hanako) = game xs