#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int q;
    scanf("%d",&q);
    while (q--){
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        int k = (max(a,b)-1)/(min(a,b)+1)+1;
        //printf("k is %d\n",k);
        int lo = 0, hi = a+b;
        while (lo < hi){
            int m = (lo+hi+1)/2;
            int b1 = m/(k+1);
            int a1 = m-b1;
            int b2 = b-b1;
            int a2 = a-a1;
            if ((ll)b2 < (ll)(a2+1)*k){
                ///first part
                lo = m;
            }
            else{
                hi = m-1;
            }
        }
        for (int i = c; i <= d; i++){
            if (i <= lo){
                printf("%c",i%(k+1)==0?'B':'A');
            }
            else{
                printf("%c",(a+b-i+1)%(k+1)==0?'A':'B');
            }
        }
        printf("\n");
    }
}
