#include <bits/stdc++.h>
#define int long long
#define LL long long 
using namespace std;
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }

int n,a,b,c,d,k;
inline bool check(int l){
	LL cntl = l / (k+1),r = l % (k+1);
	LL cnta = a - (cntl * k + r),cntb = b - (cntl);
	return cntb <= cnta * k;
}
inline void solve(){
	read(a),read(b),read(c),read(d),k = max(ceil(1.0*a/(b+1)),ceil(1.0*b/(a+1)));
	n = a + b;
	int L = 0,R = n,Mid,Ans = 0;
	while (L < R){
		Mid = L+R>>1;
		if (check(Mid)) Ans = Mid+1,L = Mid+1; else R = Mid;
	}
	int l = Ans;
	LL cntl = l / (k+1),r = l % (k+1);
	int cnta = a - (cntl * k + r),cntb = b - (cntl);
	int w = l + 1 + (cntb - (cnta) * k);
	for (int i = c; i <= d; ++i){
		if (i <= l){
			putchar(i % (k+1) == 0 ? 'B' : 'A');
		}
		else{
			int j = i - w;
			putchar(j %(k+1) == 0 ? 'A' : 'B');
		}
	}
	putchar('\n');
}

signed main(){
	int T; read(T); while (T--) solve();
	return 0;
}