#include<iostream>
#include<cstdio>
using namespace std;
int Q,A,B,C,D,k,l,r,mid,bs,as;
int calc(int x)
{
	if(x<=l*(k+1)) return x%(k+1)==0; x-=l*(k+1);
	if(x<=as) return 0; x-=as;
	if(x<=bs) return 1; x-=bs;
	return x%(k+1)!=1;
}
void solve(int A,int B,int C,int D)
{
	k=(max(A,B)-1)/(min(A,B)+1)+1;
//	cout<<k<<endl;
	l=0,r=A/k,mid;
	while(l<r)
	{
		mid=(l+r+1)/2;
		if((B-mid)/k>A-mid*k) r=mid-1;
		else l=mid;
	}
	bs=(B-l)%k,as=A-l*k-(B-l-bs)/k;
//	cout<<l<<" "<<as<<" "<<bs<<endl;
	for(int i=C;i<=D;i++)
	printf("%c",calc(i)+'A');
	puts("");
}
int main()
{
	scanf("%d",&Q);
	while(Q--)
	{
		scanf("%d%d%d%d",&A,&B,&C,&D);
		solve(A,B,C,D);
	}
	return 0;
}