#include using namespace std; // Tính giá trị Grundy cho cột có x thanh gỗ long long get_grundy(long long x) { while (x % 2 == 1) { x /= 2; } return x / 2; } void solve() { int n; cin >> n; long long xor_sum = 0; for (int i = 0; i < n; ++i) { long long a; cin >> a; xor_sum ^= get_grundy(a); } if (xor_sum != 0) { cout << "A\n"; } else { cout << "B\n"; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); freopen("RUTGO.INP", "r", stdin); freopen("RUTGO.OUT", "w", stdout); int q; if (cin >> q) { while (q--) { solve(); } } return 0; }