import           Control.Monad
import           Data.List

main :: IO ()
main = do
  n <- readLn
  jList <- replicateM n getLine
  let
    app :: [String] -> [(String, Int)]
    app jl = map (\x -> (x, count x jl)) ["AC", "WA", "TLE", "RE"]
      where
        count :: String -> [String] -> Int
        count _ [] = 0
        count str (x:xs) = if str == x then 1 + (count str xs) else count str xs
    afterApp = app jList
  mapM_ (\x -> putStrLn $ (fst x) ++ " x " ++ (show $ snd x)) afterApp
