#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

#define int long long
#define double long double

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

template<class T> string tostr(T x) { stringstream o; o << x; return o.str(); }
template<class T> T sqr(T x) { return x*x; }
template<class T> T mypow(T x, int n) { T r = 1; while (n > 0) { if (n & 1)r = r*x; x = x*x; n >>= 1; }return r; }

int toint(string s) { int v; stringstream i(s); i >> v; return v; }
bool check(int x, int y, int w, int h) { return x >= 0 && y >= 0 && w > x && h > y; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define FILL(a,v)	fill(a,a+sizeof(a)/sizeof(*a),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e17 + 9;

/* segment tree
現在のノードをkとすると
子  (k - 1) /2;
親  (k * 2)+1,(k * 2)+2;

SegmentTree<int> sg(10, 0, [](int t0, int t1) { return t0 + t1; });
sg.update(1, 5);
cout << sg.query(0, 10) << endl;
*/
template<class T>
struct SegmentTree {
	int size;

	SegmentTree(int size, T i_val, function<T(T, T)> solve)
		: i_val(i_val)
		, solve(solve)
	{
		this->size = 1;
		while (this->size < size)this->size *= 2;
		data.resize(2 * this->size - 1, i_val);
	}

	//k番目の値(0-indexed)をaに変更
	void update(int k, T a) {
		k += size - 1;
		data[k] = a;
		while (k > 0) {
			k = (k - 1) / 2;
			data[k] = solve(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}
	//[a,b]の値を返す
	T query(int a, int b) {
		return segquery(a, b + 1, 0, 0, size);
	}

private:
	vector<T> data;
	function<T(T, T)> solve;
	T i_val;
	//[a,b)の値を返す
	//セグメントツリー内部で呼ぶ関数
	T segquery(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return i_val;
		if (a <= l && r <= b) { return data[k]; }
		else {
			T vl = segquery(a, b, k * 2 + 1, l, (l + r) / 2);
			T vr = segquery(a, b, k * 2 + 2, (l + r) / 2, r);
			return solve(vl, vr);
		}
	}
};

signed main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	string s, t;
	cin >> s >> t;

	int n = s.size();
	int m = t.size();

	SegmentTree<int> sA(n, 0, [](int t0, int t1) { return t0 + t1; });
	SegmentTree<int> sB(n, 0, [](int t0, int t1) { return t0 + t1; });
	SegmentTree<int> tA(m, 0, [](int t0, int t1) { return t0 + t1; });
	SegmentTree<int> tB(m, 0, [](int t0, int t1) { return t0 + t1; });

	rep(i, n) {
		if (s[i] == 'A') {
			sA.update(i, 1);
		}
		else {
			sB.update(i, 1);
		}
	}
	rep(i, m) {
		if (t[i] == 'A') {
			tA.update(i, 1);
		}
		else {
			tB.update(i, 1);
		}
	}


	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--; b--; c--; d--;
		int sk = (sA.query(a, b) + sB.query(a, b) * 2 - 1) % 3;
		int tk = (tA.query(c, d) + tB.query(c, d) * 2 - 1) % 3;
		if (sk == tk) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 9168