import Data.List
import Data.Maybe

main = do
    n <- getLine >>= return . read
    ss <- mapM (\_ -> getLine) [1..n]
    let g = map (\x -> (head x, length x)) $ group $ sort ss
    putStrLn ("AC x " ++ show (a "AC" g))
    putStrLn ("WA x " ++ show (a "WA" g))
    putStrLn ("TLE x " ++ show (a "TLE" g))
    putStrLn ("RE x " ++ show (a "RE" g))

a code g = if isJust c then snd (fromJust c) else 0
    where
        c = b code g

b code g = find (\x -> (fst x) == code ) g