#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll,ll> Pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define ABS(x) (((x) > 0 ) ? (x) : (-(x)))
#define MAX2(x, y) (((x) > (y)) ? (x) : (y))
#define MIN2(x, y) (((x) < (y)) ? (x) : (y))

#define MAX3(x, y, z) ( (x) > (y)  ? ( (x) > (z) ? (x) : (z)  ) : ( (y) > (z) ? (y) : (z) )  )
#define MIN3(x, y, z) ( (x) < (y)  ? ( (x) < (z) ? (x) : (z)  ) : ( (y) < (z) ? (y) : (z) )  )
#define MID3(val1,val2,val3) MAX2(MIN2(MAX2(val1,val2),val3),MIN2(val1,val2))

#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define INF 987654321
#define IINF 987654321987654321
int N,M,K,T,tc;

struct segTree{
    int data[100500];
    void update(int p, int val){
        for(;p<100500;p+=(p&-p)) data[p] += val;
    }
    int query(int l, int r){
        int res = 0;
        for(;r>=1;r-=(r&-r)) res += data[r];
        for(l--;l>=1;l-=(l&-l)) res -= data[l];
        return res;
    }
};
segTree aA,aB,bA,bB;
int main(void){
    string a,b; cin >> a >> b;
    for(int i=1;i<=a.size();i++){
        if( a[i-1] == 'A' ){
            aA.update(i,1);
        }
        if( a[i-1] == 'B' ){
            aB.update(i,1);
        }
    }


    for(int i=1;i<=b.size();i++){
        if( b[i-1] == 'A' ){
            bA.update(i,1);
        }
        if( b[i-1] == 'B' ){
            bB.update(i,1);
        }
    }
    geti(tc);
    while(tc--){
        int a1,a2,b1,b2;
        geti(a1,a2,b1,b2);

        int aa,ab,ba,bb;
        aa = aA.query(a1,a2);
        ab = aB.query(a1,a2);
        ba = bA.query(b1,b2);
        bb = bB.query(b1,b2);
        if( aa > ab ){
            aa -= ab; ab = 0; aa%=3;
        }
        else {
            ab -= aa; aa = 0; ab %= 3;
        }
        if( ba > bb ){
            ba -= bb; bb = 0; ba %= 3;
        }else{
            bb -= ba; ba = 0; bb %= 3;
        }
        if( aa == 2 ){
            ab = 1; aa = 0;
        }
        if( ab == 2 ){
            aa = 1; ab = 0;
        }
        if( ba == 2 ){
            bb = 1; ba = 0;
        }
        if( bb == 2 ){
            ba = 1; bb = 0;
        }
        /*
        while(true){
            if( aa == 1 && ab == 0 ) break;
            if( aa == 0 && ab == 1 ) break;
            if( aa == 0 && ab == 0 ) break;
            if( aa == 0 ){
                if( ab >= 3 ){

                }
            }
            else if( ab == 0 ){

            }
        }
        */

        if( aa == ba && ab == bb ){
            printf("YES\n");
        }else{
            printf("NO\n");
        }

    }
}



Measured memory_bytes: 2560