#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1E5 + 10;

int f[MAXN], g[MAXN];

void build(int a[]){
	static char s[MAXN];
	scanf("%s", s);
	int n = strlen(s);
	for (int i = 0; i < n; ++i)
		a[i + 1] = s[i] == 'A' ? 1 : 2;
	partial_sum(a, a + n + 1, a);
}

int main(){
	build(f);
	build(g);

	int m;
	scanf("%d", &m);
	while (m--){
		int a, b, c, d;
		scanf("%d%d%d%d", &a, &b, &c, &d);
		puts((f[b] - f[a - 1] - g[d] + g[c - 1]) % 3 == 0 ? "YES" : "NO");
	}
	return 0;
}
