module Main where

import Data.List (foldl')

main :: IO ()
main = do
  _ <- readLn :: IO Int
  results <- lines <$> getContents
  putStr "AC x " >>= \_ -> print $ count "AC" results
  putStr "WA x " >>= \_ -> print $ count "WA" results
  putStr "TLE x " >>= \_ -> print $ count "TLE" results
  putStr "RE x " >>= \_ -> print $ count "RE" results
  where
    count k vs = foldl' (\cnt v -> if v == k then cnt + 1 else cnt) 0 vs
