#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



#if 1

void func(const string& s, vector <int>& suma, vector <int>& sumb )
{
	const int N = SZ(s);
	suma.resize(N+1);
	sumb.resize(N+1);
	suma[0] = 0;
	sumb[0] = 0;

	for (int i = 0; i < N; ++i)
	{
		if (s[i] == 'A')
		{
			suma[i+1] = suma[i] + 1;
		}
		else
		{
			suma[i + 1] = suma[i];
		}

		if (s[i] == 'B')
		{
			sumb[i + 1] = sumb[i] + 1;
		}
		else
		{
			sumb[i + 1] = sumb[i];
		}

	}


}

int main()
{
	string S,T;
	cin >> S >> T;

	vector <int> sa, sb, ta, tb;

	func(S, sa, sb);
	func(T, ta, tb);

	int q;
	cin >> q;

	for (int i = 0; i < q; ++i)
	{
		int sl,sr,tl,tr;
		cin >> sl >> sr >> tl >> tr;

		const int sA = (sa[sr] - sa[sl-1])%3;
		const int sB = (sb[sr] - sb[sl - 1])%3;
		const int tA = (ta[tr] - ta[tl - 1])%3;
		const int tB = (tb[tr] - tb[tl - 1])%3;

		const int spoint = ((sA-sB)+3)%3;
		const int tpoint = ((tA-tB)+3)%3;

		// BEGIN CUT HERE
//		cout << " sA=" << sA << " sB=" << sB << " tA=" << tA << " tB=" << tB << " spoint=" << spoint << " tpoint=" << tpoint << endl;
		// END CUT HERE


		if (spoint == tpoint)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}

	return 0;
}

#elif 1

const ll MOD = 1e9 + 7;

ll weightLen(const vector <ll>& a)
{
	int n = SZ(a);

	ll ret = 0;

	for (int i = 0; i < n-1; ++i)
	{
		ll tmp = (a[i+1]-a[i]);
		tmp %= MOD;
		tmp *= (i+1);
		tmp %= MOD;
		tmp *= (n-i-1);
		tmp %= MOD;

		ret += tmp;
		ret %= MOD;
	}

	return ret;

}

int main()
{
	int n, m;
	cin >> n >> m;

	vector <ll> x(n);
	vector <ll> y(m);

	for (int i = 0; i < n; ++i)
	{
		cin >> x[i];
	}

	for (int i = 0; i < m; ++i)
	{
		cin >> y[i];
	}


	ll ans = weightLen(x);
	ans %= MOD;
	ans *= weightLen(y);
	ans %= MOD;

	cout << ans << endl;


	return 0;
}


#else

int main()
{
	int n;
	cin >> n;

	int minFreq[256] = {};
	for (int i = 0; i < 256; ++i)
	{
		minFreq[i] = BIG;
	}

	for (int i = 0; i < n; ++i)
	{
		string s;
		cin >> s;

		int freq[256]={};
		for (int k = 0; k < SZ(s); ++k)
		{
			freq[s[k]]++;
		}

		for (int i = 0; i < 256; ++i)
		{
			amin(minFreq[i], freq[i]);
		}
	}

	string ans;
	for (int i = 'a'; i <= 'z'; ++i)
	{
		ans += string(minFreq[i], i);
	}

	cout << ans << endl;




	return 0;
}

#endif



Measured memory_bytes: 2432