import Control.Monad
import Control.Applicative
import Data.List

main :: IO ()
main = do
        n <- readLn
        ws <- replicateM n getLine
        let a = foldl solve 0 $ map convert ws
        putStrLn $ if a == 0 then "YES" else "NO"

solve :: Int -> Int -> Int
solve a b = if a + b >= 0
                then a + b
                else -100

convert :: String -> Int
convert s = if s == "A" then 1 else -1