#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring> 
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
int up(long long a,long long b){
	return (a+b-1)/b;
}
int main(){
	int T;
	cin>>T;
	while(T--){
		int x,y,a,b;
		cin>>a>>b>>x>>y;
		int l=up(max(a,b),min(a,b)+1);
	//	if(a>b){
			int le=0,r=min(a,b);
			int res=0;
			while(le<=r){
				int mid=le+r>>1;
		//		cout<<mid<<endl;
				if(up(b-mid,l)<=a-mid*l&&a-mid*l<up(b-mid,l)+l){
					res=mid;
					le=mid+1;
				}
				else{
					if(a-mid*l<up(b-mid,l)) r=mid-1;
					else le=mid+1;
				}
			}
			int tmpa=a-res*l-up(b-res,l)+1,tmpb=(b-res-1)%l+1,re1=res,re2=(b-res-1)/l;
//			cout<<tmpa<<" "<<tmpb<<" "<<re1<<" "<<re2<<endl;
			int fir=(l+1)*re1,sec=fir+tmpa,thi=sec+tmpb,fou=thi+(l+1)*re2;
			for(int i=x;i<=min(fir,y);i++) if(i%(l+1)) cout<<"A";else cout<<"B";
			for(int i=max(x,fir+1);i<=min(sec,y);i++) cout<<"A";
			for(int i=max(x,sec+1);i<=min(thi,y);i++) cout<<"B";
			for(int i=max(x,thi+1);i<=y;i++) if((i-thi)%(l+1)!=1) cout<<"B"; else cout<<"A";
			cout<<endl;
	//	}
	//	else{
	//		
	//	}
		
	}
} 