#include <bits/stdc++.h> 

using namespace std;

#define rep(i,n) for(long long int i=0;i<n;i++)
#define rep1(i,n) for(long long int i=1;i<=n;i++)
#define repU(i,bottom,ceiling) for(long long int (i)=(bottom);(i)<=(ceiling);(i)++)
#define repD(i,ceiling,bottom) for(long long int (i)=(ceiling);(i)>=(bottom);(i)--)
#define pub push_back
#define pob pop_back
#define pf printf
#define sf scanf
#define ci(a) cin>>a
#define lco(a) cout<<a<<endl
#define co(a) cout<<a
#define vci(v) for(long long int i=0;i<v.size();i++) cin>>v[i]
#define vco(v) for(long long int i=0;i<v.size();i++){ cout<<v[i]<<' '; } cout<<endl
#define mp make_pair
#define fir first
#define sec second
#define clr(arr) memset((arr),0,sizeof(arr))

typedef long long int ll;
typedef double db;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vb;
typedef vector<vector<double>> vvd;
typedef vector<long long int> vll;
typedef vector<vector<long long int>> vvll;
typedef pair<int,int> pii;

const string alphabet("abcdefghijklmnopqrstuvwxyz");
const vector<pair<int,int>> dir={{0,0},{1,0},{1,1},{0,1},{-1,1},{0,-1},{-1,-1},{0,-1},{1,-1}};
const long double Pi=3.141592653589793238462643383279502884197;
const long double Napier=2.71828182845904523536;
const int Inf=(int)2e9+1e8;
const int Mod=(int)1e9+7;

template<typename T,typename U>                                                   
inline pair<T,U> operator+(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir+r.fir,l.sec+r.sec};                                    
} 

template<typename T,typename U> 
inline pair<T,U> operator-(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir-r.fir,l.sec-r.sec};                                    
} 

template<typename T,typename U>                                                   
inline pair<T,U> operator*(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir*r.fir,l.sec*r.sec};                                    
}

template<typename T,typename U>                                                   
inline pair<T,U> operator/(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir/r.fir,l.sec/r.sec};                                    
}

template<typename T> inline void Swap(T *x,T *y){ T tem=*x; *x=*y; *y=tem; }

long long int rem(long long int n,long long int m){
	if(!m) return 0;
	return (n<0?(n%m)+m:(n%m));
}
  
             
/*The main code follows below*/


inline bool judge(int N_a,int A,int B,int q){
	int N_b=max(0,(N_a-1)/q);
	return ((B-N_b)/q+((B-N_b)%q!=0)<=(A-N_a+1));
}

inline int binsearch(int A,int B,int q){
	int upper=A+1;
	int lower=0;
	while(upper-lower>1){
		int mid=(upper+lower)/2;
		if(judge(mid,A,B,q)) lower=mid;
		else upper=mid;
	}
	return lower;
}

inline void solve(){
	int A,B,C,D;
	ci(A>>B>>C>>D);
	int q=max(A,B)/(1+min(A,B))+(max(A,B)%(1+min(A,B))!=0);
	int N_a=binsearch(A,B,q);
	int N_b=max(0,(N_a-1)/q);
	int L_part=N_a+N_b;
	for(;C<=min(D,L_part);C++){
		if(C%(q+1)) co('A');
		else co('B');
	}
	for(;C<=D;C++){
		if((A+B+1-C)%(q+1)) co('B');
		else co('A');
	}
	co(endl);
	return ;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int Q; ci(Q);
	rep(i,Q) solve();
	return 0;
}

Measured memory_bytes: 384