import Data.List
import Control.Applicative

judge :: [String] -> [Int]
judge [t, h]
    | t > h  = [3, 0]
    | t == h = [1, 1]
    | t < h  = [0, 3]

main = do
    _ <- getLine
    putStrLn =<< (unwords . map show . map sum . transpose . map judge . map words . lines) <$> getContents