#include <bits/stdc++.h>
using namespace std;
int main() {
int t;cin>>t;
while (t--){
string s;cin>>s;
int ans1=0;
int ans2=0;
for (int k=0;k<s.size();k++){
if (s[k]=='B') ans1++;
else ans2++;
}
if (ans1>ans2) cout<<'B'<<endl;
else cout<<'A'<<endl;
}
return 0;
}
361A - Levko and Table | 5E - Bindian Signalizing |
687A - NP-Hard Problem | 1542C - Strange Function |
961E - Tufurama | 129D - String |
888A - Local Extrema | 722B - Verse Pattern |
278A - Circle Line | 940A - Points on the line |
1742C - Stripes | 1742F - Smaller |
1742B - Increasing | 1742A - Sum |
1742D - Coprime | 390A - Inna and Alarm Clock |
1398B - Substring Removal Game | 1742G - Orray |
416B - Art Union | 962A - Equator |
803B - Distances to Zero | 291A - Spyke Talks |
1742E - Scuza | 1506D - Epic Transformation |
1354G - Find a Gift | 1426F - Number of Subsequences |
1146B - Hate "A" | 1718C - Tonya and Burenka-179 |
834A - The Useless Toy | 1407D - Discrete Centrifugal Jumps |