#include <iostream>
using namespace std;
int main(void){
    int n,m,q,x[100002],y[100002];
    string s,t;
    cin>>s>>t;
    n=s.length();
    m=t.length();
    x[0]=y[0]=0;
    for(int i=0;i<n;i++){
        x[i+1]=x[i]+1;
        if(s[i]=='B')x[i+1]++;
    }
    for(int i=0;i<m;i++){
        y[i+1]=y[i]+1;
        if(t[i]=='B')y[i+1]++;
    }
    cin>>q;
    for(int i=0;i<q;i++){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        int z=(x[b]-x[a-1]-y[d]+y[c-1]+3000000)%3;
        if(z==0){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
}
