Box Splitting Game

Decide whether the first or second player wins the two-box stone-splitting game from starting counts N and M.

Medium4Game theoryDynamic programmingNo attempts yetTime limit2sMemory limit512 MB

Problem

The box splitting game is played with two boxes.

At the start one box holds NN stones and the other holds MM stones. Two players take turns.

On your turn you choose one box and empty it completely. You then take the stones sitting in the other box and put them into the two boxes. Each of the two boxes must hold at least 1 stone afterwards.

The player who leaves exactly 1 stone in each box wins the game.

Given NN and MM, write a program that finds the winner when both players play the game perfectly.

Input

The first line contains NN and MM, separated by a space. (1N,M1001 \le N, M \le 100, and NN and MM are never both 1.)

Output

Print A if the player who starts the game wins, and B if the player who moves second wins.