#include <bits/stdc++.h>
using namespace std;
int Case,k,n,a,b,c,d;
int l,r,mid,A,B;
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>Case;
	while(Case--)
	{
		cin>>a>>b>>c>>d;
		n=a+b;
		l=0,r=n+1,k=(max(a,b)-1)/(min(a,b)+1)+1;
		while(l<r)
		{
			mid=(l+r)>>1;
			A=a-mid/(k+1)*k-mid%(k+1),B=b-mid/(k+1);
			if(B<=1LL*A*k) l=mid+1;
			else r=mid;
		}
		A=a-l/(k+1)*k-l%(k+1),B=b-l/(k+1),r=l+B-A*k+1;
		for(int i=c;i<=min(d,l);i++) cout<<((i%(k+1))?"A":"B");
		for(int i=max(c,l+1);i<=d;i++) cout<<(((i-r)%(k+1))?"B":"A");
		cout<<"\n";
	}
	return 0;
}