#include <bits/stdc++.h>

using namespace std;

int T, n, k;
int a, b, c, d;

long long calcu(int t);

int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d%d", &a, &b, &c, &d);
    n = a + b, k = (max(a, b) - 1) / (min(a, b) + 1) + 1;
    int l = 0, r = n + 1;
    while (l < r) {
      int mid = (l + r) >> 1;
      if (calcu(mid) <= 0) l = mid + 1;
      else r = mid;
    }
    r = l + calcu(l) + 1;
    for (int i = c; i <= min(d, l); ++i) 
      putchar(i % (k + 1) ? 'A' : 'B');
    for (int i = max(c, l + 1); i <= d; ++i)
      putchar((i - r) % (k + 1) ? 'B' : 'A');
    puts("");
  }
}

long long calcu(int t) {
  int anum = a - t / (k + 1) * k - t % (k + 1),
      bnum = b - t / (k + 1);
  return bnum - 1ll * anum * k;
}
