Hide

Problem I
Badminton

Languages da en
/problems/badminton/file/statement/en/img-0001.jpg

Badminton is a widely played racket sport in Denmark. A badminton match consists of sets; you play the best of three sets. A player wins a set by being the first to reach at least $21$ points and having at least $2$ points more than the opponent, or by being the first to reach $30$ points.

Ane and Bo have upgraded their fully automatic score counter, so they can now record entire matches; they just need to implement the logic for determining the winner of the match.

Input

The input consists of a sequence of set scores separated by spaces. Each set consists of $2$ point values separated by a hyphen, -. Each point value is an integer, at least $0$ and at most $30$. The first value is Ane’s points, the second is Bo’s.

Output

If Ane has won the match, write “A”. If Bo has won the match, output “B”. If the match is still ongoing, write “?”. If the score counter is broken and the given score cannot occur in a correctly played and recorded badminton match, write “!”.

Sample Input 1 Sample Output 1
21-0 21-0
A
Sample Input 2 Sample Output 2
21-0 19-21 29-30
B
Sample Input 3 Sample Output 3
0-0
?
Sample Input 4 Sample Output 4
21-18 1-5
?
Sample Input 5 Sample Output 5
21-18 0-0
?
Sample Input 6 Sample Output 6
21-18 21-0 21-0 0-0
!
Sample Input 7 Sample Output 7
0-0 0-0
!