S = input()

T = input()

Q = int(input())

qs = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(Q)]



smem = [0]

for c in S:

    if c == 'A':

        smem.append(smem[-1] + 1)

    else:

        smem.append(smem[-1] - 1)



tmem = [0]

for c in T:

    if c == 'A':

        tmem.append(tmem[-1] + 1)

    else:

        tmem.append(tmem[-1] - 1)



anss = []

for s1,s2,t1,t2 in qs:

    a = smem[s2+1] - smem[s1]

    b = tmem[t2+1] - tmem[t1]

    if a%3 == b%3:

        anss.append('YES')

    else:

        anss.append('NO')

print(*anss, sep='\n')

S = input()

T = input()

Q = int(input())

qs = [tuple(map(int,input().split())) for i in range(Q)]



sas = [0]

sbs = [0]

for c in S:

    a = int(c=='A')

    sas.append(sas[-1] + a)

    sbs.append(sbs[-1] + (a^1))



tas = [0]

tbs = [0]

for c in T:

    a = int(c=='A')

    tas.append(tas[-1] + a)

    tbs.append(tbs[-1] + (a^1))



ans = []

for a,b,c,d in qs:

    sa = sas[b] - sas[a-1]

    sb = sbs[b] - sbs[a-1]

    ta = tas[d] - tas[c-1]

    tb = tbs[d] - tbs[c-1]

    s = (sb-sa)%3

    t = (tb-ta)%3

    ans.append('YES' if s==t else 'NO')

print(*ans, sep='\n')

S = input()
T = input()
Q = int(input())
qs = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(Q)]
smem = [0]
for c in S:
    if c == "A":
        smem.append(smem[-1] + 1)
    else:
        smem.append(smem[-1] - 1)
tmem = [0]
for c in T:
    if c == "A":
        tmem.append(tmem[-1] + 1)
    else:
        tmem.append(tmem[-1] - 1)
anss = []
for s1, s2, t1, t2 in qs:
    a = smem[s2 + 1] - smem[s1]
    b = tmem[t2 + 1] - tmem[t1]
    if a % 3 == b % 3:
        anss.append("YES")
    else:
        anss.append("NO")
print(*anss, sep="\n")

S = input()
T = input()
Q = int(input())
qs = [tuple(map(int, input().split())) for i in range(Q)]
sas = [0]
sbs = [0]
for c in S:
    a = int(c == "A")
    sas.append(sas[-1] + a)
    sbs.append(sbs[-1] + (a ^ 1))
tas = [0]
tbs = [0]
for c in T:
    a = int(c == "A")
    tas.append(tas[-1] + a)
    tbs.append(tbs[-1] + (a ^ 1))
ans = []
for a, b, c, d in qs:
    sa = sas[b] - sas[a - 1]
    sb = sbs[b] - sbs[a - 1]
    ta = tas[d] - tas[c - 1]
    tb = tbs[d] - tbs[c - 1]
    s = (sb - sa) % 3
    t = (tb - ta) % 3
    ans.append("YES" if s == t else "NO")
print(*ans, sep="\n")

-qs = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(Q)] -smem = [0] +qs = [tuple(map(int, input().split())) for i in range(Q)] +sas = [0] +sbs = [0] -    if c == "A": -        smem.append(smem[-1] + 1) -    else: -        smem.append(smem[-1] - 1) -tmem = [0] +    a = int(c == "A") +    sas.append(sas[-1] + a) +    sbs.append(sbs[-1] + (a ^ 1)) +tas = [0] +tbs = [0] -    if c == "A": -        tmem.append(tmem[-1] + 1) -    else: -        tmem.append(tmem[-1] - 1) -anss = [] -for s1, s2, t1, t2 in qs: -    a = smem[s2 + 1] - smem[s1] -    b = tmem[t2 + 1] - tmem[t1] -    if a % 3 == b % 3: -        anss.append("YES") -    else: -        anss.append("NO") -print(*anss, sep="\n") +    a = int(c == "A") +    tas.append(tas[-1] + a) +    tbs.append(tbs[-1] + (a ^ 1)) +ans = [] +for a, b, c, d in qs: +    sa = sas[b] - sas[a - 1] +    sb = sbs[b] - sbs[a - 1] +    ta = tas[d] - tas[c - 1] +    tb = tbs[d] - tbs[c - 1] +    s = (sb - sa) % 3 +    t = (tb - ta) % 3 +    ans.append("YES" if s == t else "NO") +print(*ans, sep="\n")