Time Limit: 1 Second

Memory Limit: 65536 KB


Helianthuswolf Co. Ltd. is a multinational "Intestnet" company. Its revenue from global markets grew year by year. Helianthuswolf unveiled its new smartphone Q10 in the spring of 2017.

As a high-end smartphone, Q10 uses UFS2.1 or UFS2.0 or eMMC5.1 for its flash drive. Q10 also uses LPDDR3 or LPDDR4 as its memory, and its CPU does not support DDR3. In order to better show the performance of the Q10, Helianthuswolf reduced the oleophobic coating layer of some smartphones.

Helianthuswolf produces Q10 in two factories. As you see in the following table, the probabilities of the components they use are different. And the use of each component is an independent event.

Flash Drive Memory Oleophobic Layer
UFS2.0 UFS2.1 eMMC5.1 LPDDR3 LPDDR4 Sparse Normal
A 20% 30% 50% 40% 60% 70% 30%
B 30% 50% 20% 70% 30% 40% 60%

Now we get the information of \(n\) Q10 smartphones produced by one factory. The \(n\) smartphones are all produced by either factory A or factory B. Please find out which factory is more likely to produce these smartphones.


There are multiple test cases. The first line of the input contains an integer \(T\) (\(1\le T \le 100\)), indicating the number of test cases. For each test case:

The first line is an integer \(n\) (\(1\le n \le 10000\)), indicating the number of smartphones.

The following \(n\) lines are the information of the smartphones, each line has three words describing the components.


For each test case, output "A" (without quotes) if it is more likely for factory A to produce these smartphones, output "B" (without quotes) if it is more likely for factory B to produce these smartphones. If it is equally likely for the two factories to produce these smartphones, output "E" (without quotes).

Sample Input

eMMC5.1 LPDDR4 Sparse
UFS2.1 LPDDR3 Sparse
UFS2.0 LPDDR4 Normal
UFS2.1 LPDDR3 Sparse
eMMC5.1 LPDDR4 Normal
UFS2.0 LPDDR4 Normal

Sample Output