import Data.Array
import Control.Monad

main = do
  getLine
  co <- getContents
  compute $ lines co

compute :: [String] -> IO ()
compute js = do
  let ar = accumArray (+) 0 (1,4) $ [ (s2i j, 1) | j <- js ]
  mapM_ (\(a,b) -> putStrLn (unwords [a, "x", show b])) $ zip ["AC","WA","TLE","RE"] $ elems ar

s2i "AC" = 1
s2i "WA" = 2
s2i "TLE" = 3
s2i "RE" = 4
