#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1e9+7;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;
///////////////////////////////////////////////
string S,T;
int Ss[100002] = {};
int Ts[100002] = {};

PII count(int i,int j,int K){
	int A,B;
	if (K == 0){
		A = Ss[j] - Ss[i-1];
		B = j - i + 1 - A;
	}else{
		A = Ts[j] - Ts[i-1];
		B = j - i + 1 - A;
	}

	return MP(A,B);
}

int main() {
	cin >> S >> T;
	int q; cin >> q;
	for (int i = 0; i < S.length(); ++i) {
		if (S[i] == 'A') Ss[i+1] = Ss[i] + 1;
		else Ss[i+1] = Ss[i];
	}

	for (int i = 0; i < T.length(); ++i) {
		if (T[i] == 'A') Ts[i+1] = Ts[i] + 1;
		else Ts[i+1] = Ts[i];
	}

	REP(i,q){
		int a,b,c,d; cin >> a >> b >> c >> d;
		ll A1,B1,A2,B2;
		A1 = count(a,b,0).fst;
		B1 = count(a,b,0).snd;
		A2 = count(c,d,1).fst;
		B2 = count(c,d,1).snd;

		A2 = A2 % 3;
		B2 = B2 % 3;
		//cout << A1 << " " << B1 << " " << A2  << " " << B2 << endl;
		bool OK = false;
		FORq(x,0,3){
			FORq(y,0,3){
				if (A1 - x + 2*y < 0) continue;
				if (B1 - y + 2*x < 0) continue;
				if (((A1 - x + 2*y) % 3 == A2) and ((B1 - y + 2*x) % 3 == B2)){
					OK = true;
				}
			}
		}

		if (OK) puts("YES");
		else puts("NO");
		/*
		AB = count(a,b,0);
		cout << AB.fst << " " << AB.snd << "\n";

		AB = count(c,d,1);
		cout << AB.fst << " " << AB.snd << "\n";
		 */
	}

}

Measured memory_bytes: 1664