import Control.Monad

battle [] score0 score1 = [score0, score1]
battle (d:ds) score0 score1 = if str0 > str1
  then battle ds (score0 + 3) score1
  else if str0 < str1
    then battle ds score0 (score1 + 3)
    else battle ds (score0 + 1) (score1 + 1)
  where
    str0 = d !! 0
    str1 = d !! 1

itp19c = do
  n <- readLn
  d <- replicateM n $return . words =<< getLine
  putStrLn . unwords . map show $ battle d 0 0