Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

A. Vlad and the Best of Five
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Vladislav has a string of length $$$5$$$, whose characters are each either $$$\texttt{A}$$$ or $$$\texttt{B}$$$.

Which letter appears most frequently: $$$\texttt{A}$$$ or $$$\texttt{B}$$$?

Input

The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 32$$$) — the number of test cases.

The only line of each test case contains a string of length $$$5$$$ consisting of letters $$$\texttt{A}$$$ and $$$\texttt{B}$$$.

All $$$t$$$ strings in a test are different (distinct).

Output

For each test case, output one letter ($$$\texttt{A}$$$ or $$$\texttt{B}$$$) denoting the character that appears most frequently in the string.

Example
Input
8
ABABB
ABABA
BBBAB
AAAAA
BBBBB
BABAA
AAAAB
BAAAA
Output
B
A
B
A
B
A
A
A