import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    (a:b:c:d:_) <- map ((subtract 1) . length) . group . sort . (["AC","WA","TLE","RE"] ++) <$> replicateM n getLine
    putStrLn $ "AC x " ++ show a
    putStrLn $ "WA x " ++ show d
    putStrLn $ "TLE x " ++ show c
    putStrLn $ "RE x " ++ show b