#include<bits/stdc++.h>
using namespace std;
int q,a,b,c,d,n,k;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d",&q);
	while (q--){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		n=a+b;
		k=(max(a,b)-1)/(min(a,b)+1)+1;
		int l=0,r=n+1,A,B;
		while (l<r){
			int 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(l,d);i++){
			if (i%(k+1)) printf("A");
			else printf("B");
		}
		for (int i=max(l+1,c);i<=d;i++){
			if ((i-r)%(k+1)) printf("B");
			else printf("A");
		}
		printf("\n");
	}
	return 0;
}
