using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            ARC071.E();
        }
        class ARC071
        {
            public static void C()
            {
                var N = Read.Int();
                var S = Enumerable.Range(0, N).Select(i => Read.Str()).ToArray();

                Func<string, int[]> counter = X =>
                {
                    var res = new int[26];
                    foreach(var x in X) { res[x - 'a']++; }
                    return res;
                };
                var count = Enumerable.Range(0, 26).Select(i => 100).ToArray();
                foreach(var s in S)
                {
                    var c = counter(s);
                    for(int i = 0; i < 26; ++i)
                    {
                        count[i] = Math.Min(count[i], c[i]);
                    }
                }
                var r = "";
                for(int i = 0; i < 26; ++i)
                {
                    for(int j = 0; j < count[i]; ++j)
                    {
                        r += (char)('a' + i);
                    }
                }
                if (r != "") { Console.WriteLine(r); }
            }
            public static void D()
            {
                var N = Read.Int();
                var M = Read.Int();
                var X = Read.LongN();
                var Y = Read.LongN();

                Func<long[], MOD> func = A => {
                    var Na = A.Length;
                    MOD res = 0;
                    for(int i = 0; i < Na - 1; ++i)
                    {
                        MOD v = A[i + 1] - A[i];
                        v *= (i + 1);
                        v *= (Na - 1 - i);
                        res += v;
                    }
                    return res;
                };
                Console.WriteLine((func(X) * func(Y)).V);
            }
            public static void E()
            {
                var S = Read.Str();
                var T = Read.Str();
                var Q = Read.Int();
                var ABCD = Enumerable.Range(0, Q).Select(i => Read.IntN()).ToArray();
                var SSum = new int[S.Length + 1];
                var TSum = new int[T.Length + 1];
                for (int i = 0; i < S.Length; ++i)
                {
                    SSum[i + 1] = SSum[i] + (S[i] == 'A' ? 1 : 2);
                }
                for (int i = 0; i < T.Length; ++i)
                {
                    TSum[i + 1] = TSum[i] + (T[i] == 'A' ? 1 : 2);
                }
                var sb = new System.Text.StringBuilder();
                foreach(var abcd in ABCD)
                {
                    var s = SSum[abcd[1]] - SSum[abcd[0] - 1];
                    var t = TSum[abcd[3]] - TSum[abcd[2] - 1];
                    sb.AppendLine((s - t + 300000) % 3 == 0 ? "YES" : "NO");
                }
                Console.Write(sb.ToString());
            }
        }
        class Util
        {
        }
        struct MOD
        {
            public static long P = 1000000007;
            public readonly long V;

            public MOD(long a) { this.V = a; }
            public static implicit operator MOD(long a) { return new MOD(a); }
            public static MOD operator +(MOD a, MOD b) { return new MOD((a.V + b.V) % P); }
            public static MOD operator -(MOD a, MOD b) { return new MOD((a.V - b.V + P) % P); }
            public static MOD operator *(MOD a, MOD b) { return new MOD((a.V * b.V) % P); }
            public static MOD operator /(MOD a, MOD b) { return new MOD((a.V * b.Inverse().V) % P); }
            //public MOD Inverse() { return Util.Inverse(V, P); }
            public MOD Inverse()
            {
                long a = V, p = P;
                long b = p, c = 1, d = 0, e = 0, f = 0;
                while (b != 0)
                {
                    e = a / b;
                    f = b; b = a - e * b; a = f;
                    f = d; d = c - e * d; c = f;
                }
                c %= p;
                return c + (c < 0 ? p : 0);
            }
            //public MOD Power(long n) { return Util.Power(V, n, P); }
            public MOD Power(long n)
            {
                long a = V, p = P;
                long res = 1;
                long mult = a;
                for (int i = 0; i < 40; ++i)
                {
                    if ((n & ((long)1 << i)) > 0)
                    {
                        res = (res * mult) % p;
                    }
                    mult = (mult * mult) % p;
                }
                return res;
            }

            public override string ToString() { return V.ToString(); }
        }

        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static ulong[] ULongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToUInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M, bool isDirectional = false)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i) { dict.Add(i, new HashSet<int>()); }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN(); dict[ab[0]].Add(ab[1]);
                    if (!isDirectional) { dict[ab[1]].Add(ab[0]); }
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}


Measured memory_bytes: 30892