// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{



    char aa[100100];

    char bb[100100];

    int dp[100100];

    int dp1[100100];

    int a1,a2,a3,a4;

    char ans1,ans2;

    scanf("%s%s",&aa,&bb);

    dp[0]=0;

    for(int i=0;aa[i];i++)

    {

        if(dp[i]==0)

        {

            dp[i+1]=aa[i]-'A'+1;

        }

        else if(dp[i]==1)

        {

            if(aa[i]=='B')

            {

                dp[i+1]=0;

            }

            else

            {

                 dp[i+1]=2;

            }

        }

        else

        {

             if(aa[i]=='B')

            {

                dp[i+1]=1;

            }

            else

            {

                 dp[i+1]=0;

            }

        }

    }

     dp1[0]=0;

    for(int i=0;bb[i];i++)

    {

        if(dp1[i]==0)

        {

            dp1[i+1]=bb[i]-'A'+1;

        }

        else if(dp1[i]==1)

        {

            if(bb[i]=='B')

            {

                dp1[i+1]=0;

            }

            else

            {

                 dp1[i+1]=2;

            }

        }

        else

        {

             if(bb[i]=='B')

            {

                dp1[i+1]=1;

            }

            else

            {

                 dp1[i+1]=0;

            }

        }

    }

    int n;

    scanf("%d",&n);

    int flag=0;

    for(int ii=0; ii<n; ii++)

    {

        scanf("%d%d%d%d",&a1,&a2,&a3,&a4);

       if(dp[a1-1]==dp[a2])

       {

           ans1='e';

          // flag=1;

       }

       else if(dp[a1-1]==0&&dp[a2]!=0)

       {

           ans1=dp[a2]-1+'A';

          // flag=2;

       }

       else if(dp[a2]==0)

       {

           if(dp[a1-1]==1)

           {

               ans1='B';

            //   flag=3;

           }

           else

           {

              ans1='A';

              //flag=4;

           }

       }

       else

       {

           ans1=dp[a1-1]-1+'A';

         //  flag=5;

       }

        if(dp1[a3-1]==dp1[a4])

       {

           ans2='e';

           flag=2;

       }

       else if(dp1[a3-1]==0&&dp1[a4]!=0)

       {

           ans2=dp1[a4]-1+'A';

           flag=3;

       }

       else if(dp1[a4]==0)

       {

           if(dp1[a3-1]==1)

           {

               ans2='B';

               flag=4;

           }

           else

           {

               ans2='A';

               flag=5;

           }

       }

       else

       {

           ans2=dp1[a3-1]-1+'A';

           flag=6;

       }

     //  printf("%d\n",flag);

       //printf("%c %c\n",ans1,ans2);

              if(ans1==ans2)

       {

           printf("YES\n");

       }

       else

       {

           printf("NO\n");

       }

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

#define R register

using namespace std;

const int MAXN=100100;

char s1[MAXN],s2[MAXN];

int pr1[MAXN][2],pr2[MAXN][2];



template<class T>void read(T &x)

{

	x=0;int ff=0;char ch=getchar();

	while(ch<'0'||ch>'9'){ff|=(ch=='-');ch=getchar();}

	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}

	x=ff?-x:x;

}



int reads(char *st)

{

	int len=0;char ch=getchar();

	while(ch<'A'||ch>'B')ch=getchar();

	while(ch>='A'&&ch<='B')st[++len]=ch,ch=getchar();

	return len;

}



int main()

{

	int n1,n2;

	n1=reads(s1),n2=reads(s2);

	for(R int i=1;i<=n1;++i)

	{

		pr1[i][0]=pr1[i-1][0];

		pr1[i][1]=pr1[i-1][1];

		if(s1[i]=='A')++pr1[i][0];

		else ++pr1[i][1];

	}

	for(R int i=1;i<=n2;++i)

	{

		pr2[i][0]=pr2[i-1][0];

		pr2[i][1]=pr2[i-1][1];

		if(s2[i]=='A')++pr2[i][0];

		else ++pr2[i][1];

	}

	int m;

	read(m);

	int t1,t2,t3,t4;

	for(R int i=1;i<=m;++i)

	{

		read(t1),read(t2),read(t3),read(t4);

		int d1=(pr1[t2][0]-pr1[t1-1][0])-(pr1[t2][1]-pr1[t1-1][1]);

		int d2=(pr2[t4][0]-pr2[t3-1][0])-(pr2[t4][1]-pr2[t3-1][1]);

		int d=d1-d2;

		if(d<0)d=-d;

		if(d%3==0)puts("YES");

		else puts("NO");

	}

	return 0;

}

// Fastest known solution for this problem: