import Control.Monad
import Data.Char
import Data.Function
import Data.List
import Data.Maybe
import qualified Data.Map as M
import Text.Read
import Text.ParserCombinators.ReadPrec
import Text.Printf

newtype Pair a b = Pair { getPair :: (a, b) }

instance (Read a, Read b) => Read (Pair a b) where
  readPrec = Pair `dot` (,) <$> readPrec <* get <*> readPrec

instance (Show a, Show b) => Show (Pair a b) where
  show (Pair (a, b)) = show a ++ " " ++ show b

dot :: (c -> d) -> (a -> b -> c) -> a -> b -> d
dot = ((.).(.))

data Result = AC | WA | TLE | RE deriving (Show, Read, Eq, Ord)

main :: IO ()
main = do
  n <- readLn
  rs <- replicateM n readLn :: IO [Result]
  let count = foldr (\r mp -> M.insertWith (+) r 1 mp) M.empty rs :: M.Map Result Int
  forM_ [AC, WA, TLE, RE] $ \r -> do
    printf "%s x %d\n" (show r) (fromMaybe 0 $ count M.!? r) 
