#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int calck(int a, int b){
  if(a > b)swap(a,b);
  return b/(a+1) + (b % (a+1) != 0);
}

void solve(){
  Int a, b, c, d;
  cin >> a >> b >> c >> d;
  int k = calck(a, b);
  int bottom = 0, top = a+b;
  if((a+b)/(k+1) == a)top = 0;
  if((a+b)/(k+1) == b)bottom =a+b;
  while(top - bottom > 1){
    int mid = (top + bottom) / 2;
    int l = mid;
    while(l > 0 && l % (k+1) == k && (a+b-l) % (k+1) == 0 && (a+b-l) > 0 || l % (k+1) == 0 && l > 0 && (a+b-l) % (k+1) == k)l--;
    if(l / (k+1) * k + l % (k+1) + (a+b-l) / (k+1) >= a)top = mid;
    else bottom = mid;
  }
  int l = top;
  if(l % (k+1) == k && (a+b-l) % (k+1) == 0 && (a+b-l) > 0)l--;
  else if(l % (k+1) == 0 && l > 0 && (a+b-l) % (k+1) == k)l--;
  //  cout << l << endl;
  for(int i = c;i <= d;i++){
    if(i <= l){
      if(i % (k+1) == 0)cout << 'B';
      else cout << 'A';
    }
    else{
      if((a+b-i+1) % (k+1) == 0)cout << 'A';
      else cout << 'B';
    }
  }
  cout << endl;
}

int main(){
  Int q;
  cin >> q;
  while(q--)solve();
  return 0;
}
