#include <bits/stdc++.h>
 
using namespace std;

#define M 1000000007
#define pb emplace_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; ++i)
#define repn(i, st, ed) for(ll i=st; i<=ed; ++i)
#define repb(i, ed, st) for(ll i=ed; i>=st; --i)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define PI acosl(-1.0)
#define mp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vec;
typedef vector<pll> vecp;
typedef map<ll, ll> mpll;


const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << to_string(H) << endl;
  debug_out(T...);
}
#define LOCAL 3
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:" << endl, debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T>
T upsum(const T& l, const T& r) {
    T res;
    res = l + r;
    return res;
}
 
template<typename T>
class SegmentTree {
public:
    using F = function<T(T&, T&)>;
    vector<T> seg;
    vector<T> lazy;
    ll sz = 1;
    ll n;
    T unit;
    F up;
    SegmentTree(ll nn, F up, T unit) :n(nn), up(up), unit(unit) {
        while (sz < nn) sz <<= 1;
        seg.resize(sz * 2, unit);
        lazy.resize(sz * 2 , 0);
    }

    void push(ll v)
    {
        seg[v*2] += lazy[v];
        lazy[v*2] += lazy[v];
        seg[v*2+1] += lazy[v];
        lazy[v*2+1] += lazy[v];
        lazy[v] = 0;
    }
    void set(const ll& k, T val)
    {
        update(k, val);
    }
    T get(const ll& k) {
        return query(k, k);
    }
    void set_lazy(const ll& k, T val)
    {
        update_lazy(k ,k, val);
    }
    T get_lazy(const ll& k)
    {
        return query_lazy(k, k);
    }
    void build(vector<T> a)
    {
        ll v = 1;
        ll tl = 0;
        ll tr = n - 1;
        build(a, v, tl, tr);
    }

    void build(vector<T> a, ll v, ll tl, ll tr)
    {
        if(tl == tr){
            seg[v] = a[tl];
        }
        else
        {
            ll tm = (tl + tr) / 2;
            build(a, 2*v, tl, tm);
            build(a, 2*v+1, tm+1, tr);
            seg[v] = up(seg[2*v], seg[2*v+1]);
        }
    }

    void update(ll pos, T new_val)
    {
        update(1LL, 0LL, n-1, pos, new_val);
    }

    void update(ll v, ll tl, ll tr, ll pos,  T& new_val) 
    {
        if(tl == tr){
            seg[v] = new_val;
        }
        else
        {
            ll tm = (tl + tr) / 2;
            if(pos <= tm) update(v*2, tl, tm, pos, new_val);
            else update(v*2+1, tm+1, tr, pos, new_val);
            seg[v] = up(seg[v*2], seg[v*2+1]);
        }
    }
    void update_range(ll l, ll r, T added)
    {
        update_range(1LL, 0LL, n-1, l, r, added);
    }
    void update_range(ll v, ll tl, ll tr, ll l, ll r, T added)
    {
        if(l > r) return;
        if(l == tl && tr == r){
            seg[v] = added;
        }else{
            ll tm = (tl + tr) / 2;
            update_lazy(v*2, tl, tm, l, min(r, tm), added);
            update_lazy(v*2+1, tm+1, tr, max(l, tm+1), r, added);
            seg[v] = up(seg[v*2], seg[v*2+1]);
        }
    }
    void update_lazy(ll l, ll r, T added)
    {
        update_lazy(1LL, 0LL, n-1, l, r, added);
    }
    void update_lazy(ll v, ll tl, ll tr, ll l, ll r, T added)
    {
        if(l > r) return;
        if(l == tl && tr == r){
            seg[v] += added;
            lazy[v] += added;
        }else{
            push(v);
            ll tm = (tl + tr) / 2;
            update_lazy(v*2, tl, tm, l, min(r, tm), added);
            update_lazy(v*2+1, tm+1, tr, max(l, tm+1), r, added);
            seg[v] = up(seg[v*2], seg[v*2+1]);
        }
    }
    T query(ll a, ll b) {
        ll v = 1;
        ll tl = 0;
        ll tr = n -1;
        if(a < tl || b > tr) return 0;
        return query(v, tl, tr, a, b);
    }
    T query(ll v, ll tl, ll tr, ll l, ll r) {
        if(l > r) return 0;
        if(l == tl && r == tr){
            return seg[v];
        }
        ll tm = (tl + tr) / 2;
        T ansl = query(2*v, tl, tm, l, min(r, tm));
        T ansr = query(2*v+1, tm+1, tr, max(l, tm+1), r);
        return up(ansl, ansr);
    }
    T query_lazy(ll a, ll b)
    {
        return query_lazy(1LL, 0LL, n-1, a, b);
    }
    T query_lazy(ll v, ll tl, ll tr, ll l, ll r)
    {
        if(l > r) return INT_MAX;
        if(l == tl && tr == r) return seg[v];
        push(v);
        ll tm = (tl + tr) / 2;
        T ansl = query_lazy(v*2, tl, tm, l, min(r, tm));
        T ansr = query_lazy(v*2+1, tm+1, tr, max(l, tm+1), r);
        return up(ansl, ansr);
    }
};
void solve()
{
    string s, t;
    cin>>s>>t;
    SegmentTree<ll> sa(s.length(), upsum<ll>, 0);
    SegmentTree<ll> ta(s.length(), upsum<ll>, 0);
    ll i = 0;
    for(char x: s)
    {
   		 if(x == 'A') sa.update(i, 1LL);
   		 else sa.update(i, 2LL);
   		 i++;
    }
    i = 0;
    for(char x: t)
    {
   		 if(x == 'A') ta.update(i, 1LL);
   		 else ta.update(i, 2LL);
   		 i++;
    }
    ll test;
    cin>>test;
    while(test--){
    	ll x, y, z, w;
    	cin>>x>>y>>z>>w;
    	x--, y--, z--, w--;
    	ll ssa = sa.query(x, y);
       	ll tta = ta.query(z, w);
    	if(ssa%3 == tta%3) cout<<"YES"<<endl;
    	else cout<<"NO"<<endl;
    }
}


int main()
{

    ll Tests = 1;
    //cin>>Tests;
    while(Tests--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 11136