import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  let
    encode :: T.Text -> Int
    encode t | c == 'A'  = 0
             | c == 'W'  = 1
             | c == 'T'  = 2
             | otherwise = 3
      where
        c = T.head t
    decode :: Int -> String
    decode 0 = "AC"
    decode 1 = "WA"
    decode 2 = "TLE"
    decode _ = "RE"
    tally :: [Int] -> VU.Vector Int
    tally = VU.accum (const . succ) (VU.replicate 4 0) . map (flip (,) ())
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  ss <- sequence . replicate n $ encode <$> T.getLine :: IO [Int]
  let
    cs = map show . VU.toList . tally $ ss :: [String]
  mapM_ putStrLn $ zipWith (++) (map ((++ " x ") . decode) [0..3]) cs

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
