import Control.Applicative
import Control.Monad
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.Map.Strict (Map, (!))
import qualified Data.Map.Strict as M

main :: IO ()
main = do
  n <- readLn
  solve <$> replicateM n (head <$> B.words <$> B.getLine) >>= printAns

solve :: [ByteString] -> [Int]
solve ss = [m ! ac, m ! wa, m ! tle, m ! re]
  where
    im = M.fromList [(ac, 0), (wa, 0), (tle, 0), (re, 0)]
    m = foldl f im ss
    f m s = M.insertWith (+) s 1 m
    ac = B.pack "AC"
    wa = B.pack "WA"
    tle = B.pack "TLE"
    re = B.pack "RE"
    
printAns :: [Int] -> IO ()
printAns [a, b, c, d] = do
  putStrLn $ "AC x " ++ show a
  putStrLn $ "WA x " ++ show b
  putStrLn $ "TLE x " ++ show c
  putStrLn $ "RE x " ++ show d
