#include<bits/stdc++.h>
using namespace std;
int A,B,C,D,k;
bool pd(int x){
	if(x==0) return 1;
	if(x%(k+1)==0) x--;
	int cntB=x/(k+1),cntA=x-cntB;
	if((A-cntA+1)*(long long)k>=B-cntB)
		return 1;
	return 0;
}
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d%d",&A,&B,&C,&D);
		if(A>B) k=(A-1)/(B+1)+1;
		else k=(B-1)/(A+1)+1;
		int l=0,r=A+B,mid,ans=0;
		while(l<=r){
			mid=(l+r)>>1;
			if(pd(mid))ans=mid,l=mid+1;
			else r=mid-1;
		}
		l=ans;
		//printf("k:%d l:%d\n",k,l);
		for(int i=C;i<=D;i++){
			if(i<=l){
				if(i%(k+1)==0) printf("B");
				else printf("A");
			}
			else{
				if((A+B+1-i)%(k+1)==0) printf("A");
				else printf("B");
			}
		}
		printf("\n");
	}
	return 0;
}
