Anna and Bernard play the following game: First, they invent numbers each. Later, and alternatively, Anna writes her first number, Bernard writes his first number, Anna writes her second number, Bernard writes his second number, and so on. The first to write a number such that its middle digit is not the same as the middle digit of the previous number, loses. (The first number, always Anna’s, may have any middle digit.) If someone writes a number with an even number of digits, he or she loses immedialty. If after writing the numbers nobody loses, the game ends in a draw.
Write a program to decide who wins a game.
Input consists of a natural number , followed by natural numbers : is the first number of Anna, is the first number of Bernard, is the second number of Anna, etcetera.
Print ‘A’, ‘B’, or ‘=’,
depending on whether Anna wins, Bernard wins, or it is a tie.
Input
8 7 7 7 7 0 7 7 7 7 7 7 7 7 7 7 7
Output
B
Input
3 3 134 78345 333 6543456 999939999
Output
=
Input
2 98789 77 111 7
Output
A