#include <bits/stdc++.h>
using namespace std;
int main() {
	int q; scanf("%d", &q);
	while (q --) {
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		int L = (a + b) / (min(a, b) + 1);
		int x, y;
		if (1LL * a * L <= b) {x = 0; y = a + b;}
		else if (1LL * b * L <= a) {x = a + b; y = 0;}
		else {
			x = (1LL * a * L - b) / (L - 1);
			y = (1LL * b * L - a) / (L - 1);
		}
		for (int i = c; i <= d; ++ i) {
			if (i <= x) putchar(i % (L + 1) == 0 ? 'B' : 'A');
			else if (a + b - i + 1 <= y) putchar((a + b - i + 1) % (L + 1) == 0 ? 'A' : 'B');
			else putchar(a - x + x / (L + 1) - y / (L + 1) == 0 ? 'B' : 'A');
		}
		puts("");
	}
}