
dfs :: Int -> Int -> String -> Int -> Int -> IO Bool
dfs a b s na nb
  | null s = return True
  | head s == 'a' = if na + nb < a + b
                    then putStrLn "Yes" >> dfs a b s' (na+1) nb
                    else putStrLn "No" >> dfs a b s' na nb
  | head s == 'b' = if na + nb < a + b && nb < b
                    then putStrLn "Yes" >> dfs a b s' na (nb+1)
                    else putStrLn "No" >> dfs a b s' na nb
  | otherwise = putStrLn "No" >> dfs a b s' na nb
  where
    s' = tail s

solve (t:s:_) = dfs a b s 0 0
  where (_:a:b:_) = map read $ words t

main = getContents >>= solve.lines

