#include using namespace std; int n, one, two, three; void Solve() { one = two = 0; scanf("%d", &n); if (n == 1) { int x; scanf("%d", &x); puts(x == 1 ? "A" : "B"); } else { for (int i = 1, x; i <= n; ++i) { scanf("%d", &x); if (x == 1) ++one; else if (x == 2) ++two; else three = true; } if (three || two >= 2) puts("B"); else { if (two == 1) one += 2; puts(one % 2 ? "A" : "B"); } } } int main() { // freopen("game.in", "r", stdin); // freopen("game.out", "w", stdout); int t; scanf("%d", &t); while (t--) { Solve(); } return 0; }