
--{-# LANGUAGE StandaloneDeriving #-}
--{-# LANGUAGE BangPatterns #-}

module Main where

import Debug.Trace
import Control.Monad
import Data.List
--import Data.Char
--import qualified Data.Set.Strict as Set
--import qualified Data.Map.Strict as Map

main :: IO ()
main = do
  getLine
  c <- lines <$> getContents
  --a `traceShow`
  let m = solve c
  forM_ ["AC", "WA", "TLE", "RE"] $ \s -> do
    let i = case lookup s m of Just j -> j
                               Nothing -> 0
    putStrLn (s ++ " x " ++ show i)

solve :: [String] -> [(String, Int)]
solve c = map (\s -> (head s, length s)) . group . sort $ c
