import qualified Data.Map.Strict as M
import Control.Monad
import Data.Maybe

keys :: [String]
keys = ["AC", "WA", "TLE", "RE"]

defaultDict :: M.Map String Int
defaultDict = M.fromList . zip keys $ repeat 0

count :: M.Map String Int -> [String] -> M.Map String Int
count = let inc = M.update (\x -> Just (x + 1))
        in foldl (flip inc)

formatLn :: M.Map String Int -> String -> String
formatLn m k = let c = fromMaybe 0 (m M.!? k)
               in k ++ " x " ++ show c

main :: IO ()
main = do
  n <- readLn
  xs <- replicateM n getLine
  let dict = count defaultDict xs
  mapM_ (putStrLn . formatLn dict) keys
