#include <bits/stdc++.h>
using namespace std;

#define int long long
using ll = long long;
template<typename S, typename T>
void xmin(S&a, T const&b){if(b<a) a=b;}
template<typename S, typename T>
void xmax(S&a, T const&b){if(b>a) a=b;}


bool can_finish_1(int a, int b, int block_size){
    if(a<0 || b<0) return false;
    if(b <= block_size-1 + a*block_size)
        return true;
    return false;
}
bool can_finish_2(int a, int b, int block_size){
    if(a<0 || b<0) return false;
    if(a<=b*block_size + block_size-1){
        if(b<=a*block_size + block_size-1){
            return true;
        } else cerr << "fail2.2\n";
    } else cerr << "fail2.1\n";
    return false;
}

signed main()
{
    #ifdef LOCAL_RUN
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif // LOCAL_RUN
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int TTT; cin >> TTT; while(TTT--){

        int a, b, c, d;
        cin >> a >> b >> c >> d;
        --c;
        bool did_swap = false;
        if(a<b){
            swap(a, b);
            swap(c, d);
            c = a+b-c;
            d = a+b-d;
            did_swap = true;
        }
        int A = a, B = b;
        //cerr << A << " " << B << " " << c << " " << d << "::\n";

        int block_size = (a+b)/(b+1);

        // place aaa...ab to the left
        int a_blocks = 0;
        for(int step = 1+a/block_size;step;){
            if(can_finish_1(a-step*block_size, b-step, block_size)){
                a_blocks+=step;
                a-=step*block_size;
                b-=step;
            } else {
                step/=2;
            }
        }
        assert(a_blocks > 0);
        int b_blocks = 0;
        for(int step = 1+b/block_size;step;){
            if(can_finish_2(a-step, b-step*block_size, block_size)){
                b_blocks+=step;
                a-=step;
                b-=step*block_size;
            } else {
                step/=2;
            }
        }
        assert(a<=block_size && b <block_size);
        // now a_blocks, aaaaa, bbbb, b_blocks
        int lpos = a_blocks * (block_size+1);
        string ret;
        for(;c < lpos && c < d;++c){
            if(c%(block_size+1) == block_size){
                ret.push_back('B');
            } else {
                ret.push_back('A');
            }
        }
        int mlpos = lpos + a;
        for(;c < mlpos && c < d;++c){
            ret.push_back('A');
        }
        int mrpos = mlpos + b;
        for(;c<mrpos && c<d;++c){
            ret.push_back('B');
        }
        int rpos = mrpos + b_blocks*(block_size+1);
        assert(rpos == A+B);
        for(int x = (-rpos+c)%(block_size+1)+block_size+1;c < rpos && c<d;++c, ++x){
            if(x%(block_size+1) == 0){
                ret.push_back('A');
            } else {
                ret.push_back('B');
            }
        }

        if(did_swap){
            for(auto &e:ret){
                e^='A'^'B';
            }
            reverse(ret.begin(), ret.end());
        }
        cerr << block_size << " : " << a_blocks << " " << a << " " << b << " " << b_blocks << "\n";
        cout << ret << "\n";









    }
    return 0;
}


Measured memory_bytes: 384