#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include using namespace std; using ll = long long; const ll INF = 1ll << 60; #define REP(i,n) for(ll i=0; i using V = vector; template void chmax(A& l, const B& r){ if(l < r) l = r; } template void chmin(A& l, const B& r){ if(r < l) l = r; } void testcase(){ ll N; cin >> N; string S; cin >> S; if(N == 1){ cout << "B\n"; } else if(S[0] == 'B' && S[1] == 'B'){ cout << S << "\n"; } else if(S[0] == 'B' && S[1] == 'A'){ S[1] = 'B'; for(ll p=2; psync_with_stdio(0); ll T; cin >> T; REP(t,T) testcase(); return 0; }