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

readIntBS = fst . fromJust . BS.readInt

main = do
  s <- getLine
  t <- getLine
  q <- readLn :: IO Int

  let
    sa = listArray (0,length s) $ scanl (+) 0 (map (\c -> if c=='A' then 1 else 0) s) :: UArray Int Int
    sb = listArray (0,length s) $ scanl (+) 0 (map (\c -> if c=='A' then 0 else 1) s) :: UArray Int Int
    ta = listArray (0,length t) $ scanl (+) 0 (map (\c -> if c=='A' then 1 else 0) t) :: UArray Int Int
    tb = listArray (0,length t) $ scanl (+) 0 (map (\c -> if c=='A' then 0 else 1) t) :: UArray Int Int

  replicateM_ q $ do
    [a,b,c,d] <- map readIntBS . BS.words <$> BS.getLine :: IO [Int]
    let
      sa' = (sa!b) - (sa!(a-1))
      sb' = (sb!b) - (sb!(a-1))
      ta' = (ta!d) - (ta!(c-1))
      tb' = (tb!d) - (tb!(c-1))

    putStrLn $ if (sa'+2*sb')`mod`3 == (ta'+2*tb')`mod`3 then "YES" else "NO"
  
  
add (a,b) (c,d) = (a+c,b+d)
sub (a,b) (c,d) = (a-c,b-d)
