#include<bits/stdc++.h>
using namespace std; 
#define ll long long
#define rep(i,x,y)  for(ll i=x;i<y;++i)
#define For(i,x,y)  for(ll i=x;i<=y;++i) 
#define FOr(i,x,y)  for(ll i=x;i>=y;--i) 
#define pi acos(-1)
#define mk make_pair<ll,ll>
#define pa pair<ll,ll>
#define lf else if
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)		(x)*(x)
#define abs(x)		(x)>0?(x):-(x)
#define Mul(x,y)    x=x*(y)%mod
#define Add(x,y)    x=(x+(y))%mod
#define Max(x,y)	x=x<(y)?(y):x
#define Min(x,y)	x=x>(y)?(y):x
#define E(x) 		return writeln(x),0
#define p(x)		printf("~%d~\n",x)
#define pp(x,y)		printf("~~%d %d~~\n",x,y)
#define ppp(x,y,z)	printf("~~~%d %d %d~~~\n",x,y,z)
#define f_in(x)		freopen(x".in","r",stdin)
#define f_out(x) 	freopen(x".out","w",stdout)
#define open(x)		f_in(x),f_out(x)
#define fi first
#define se second
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif 
#define NEG 0
    const int L=2333333;
    char SZB[L],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,L,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,f=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') f=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*f; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    inline void writeln(ll x){  write(x);   puts("");   }
}using namespace SHENZHEBEI;
ll Q,A,B,x,y,q[10000],top,one;
ll calc(ll x){
	ll sizeof_A=x-x/(one+1)+(A+B-x)/(one+1);
	return sizeof_A;
}
ll get(ll x){
	ll ans=x%(one+1),ans1=x%(one+1)==0;
	if (x==A+B)	return ans;	++x;	x=(A+B-x+1);
	ans+=x%(one+1)==0,ans1+=x%(one+1);
	return max(ans,ans1);
}
void work1(){
//Ag个分成B+1分, 
	one=(A-1)/(B+1)+1/*答案*/;
	ll l=0,r=A+B,ans=0;
	while(l<=r){
		ll mid=(l+r)>>1;
		if (calc(mid)<=A)	l=mid+1,ans=mid;
		else	r=mid-1;
	}
	while(ans<A+B){
		if (calc(ans+1)<=A){	ans++;	continue;	}
		if (ans+2>A+B)	break;
		if (calc(ans+2)<=A){	ans++;	continue;	}
		if (ans+3>A+B)	break;
		if (calc(ans+3)<=A){	ans++;	continue;	}
		if (ans+4>A+B)	break;
		if (calc(ans+4)<=A){	ans++;	continue;	}
		break;
	}
	while(ans&&(get(ans)>one||calc(ans)>A))--ans;
	For(i,x,y){
		if (i<=ans)	putchar(i%(one+1)==0?'B':'A'); 
		else	putchar((A+B-i+1)%(one+1)==0?'A':'B');
	}
}
void work2(){
	swap(A,B);	x=(A+B+1)-x;	y=(A+B+1)-y;	swap(x,y);	top=0;
	one=(A-1)/(B+1)+1/*答案*/;
	ll l=0,r=A+B,ans=0;
	while(l<=r){
		ll mid=(l+r)>>1;
		if (calc(mid)<=A)	l=mid+1,ans=mid;
		else	r=mid-1;
	}
	while(ans<A+B){
		if (calc(ans+1)<=A){	ans++;	continue;	}
		if (ans+2>A+B)	break;
		if (calc(ans+2)<=A){	ans++;	continue;	}
		if (ans+3>A+B)	break;
		if (calc(ans+3)<=A){	ans++;	continue;	}
		if (ans+4>A+B)	break;
		if (calc(ans+4)<=A){	ans++;	continue;	}
		break;
	}
	while(ans&&(get(ans)>one||calc(ans)>A))--ans;
	For(i,x,y){
		if (i<=ans)	q[++top]=i%(one+1)==0?'B':'A'; 
		else	q[++top]=(A+B-i+1)%(one+1)==0?'A':'B';
	}
	while(top)	putchar('A'+'B'-q[top--]);
}
int main(){
	Q=read();
	while(Q--){
		A=read(),B=read();	x=read(),y=read();
		if (A>=B)	work1();
		else	work2();
		puts("");
	}
}
/*
*/

Measured memory_bytes: 384