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

readInt = fst . fromJust . BS.readInteger

getInt = readInt <$> BS.getLine
getNLine n = map BS.unpack <$> replicateM (fromIntegral n) BS.getLine

solve :: [Int] -> [String] -> [String]
solve (a:b:c:[d]) [] = ["AC x " <> show a, "WA x " <> show b, "TLE x " <> show c, "RE x " <> show d]
solve (a:b:c:[d]) (x:xs)
  | x == "AC"  = solve [a+1,b,c,d] xs
  | x == "WA"  = solve [a,b+1,c,d] xs
  | x == "TLE" = solve [a,b,c+1,d] xs
  | x == "RE"  = solve [a,b,c,d+1] xs

main = do
  n  <- getInt
  score <- getNLine n
  putStr $ unlines $ solve [0,0,0,0] score
