Chess game

3

2 votes
Problem

There are 2 players A and B playing a turn-based game on a square chess board of size n . In each turn, the player on move will put a knight on a cell of the board . A player can only play a 'safe' move.  In a safe move, a knight is kept at an empty cell which is not threatened by other knights on the board .

 A knight located at cell (r, c) can threaten cells (r - 1, c + 2), (r - 1, c - 2), (r + 1, c + 2), (r + 1, c - 2), (r - 2, c + 1), (r - 2, c - 1), (r + 2, c + 1) and (r + 2, c - 1) if they lie on the board.
The player who is unable to make a safe move will loose(considering A moves first).

Both players play optimally.

INPUT FORMAT

First line of input is T(number of test cases)

For each test case you will be given a number n denoting the size of chess board

 

OUTPUT FORMAT

For each case print ‘A’ or ‘B’ who wins, considering they both play optimally

 

Constraints 

1 <= T <= 100

1 <= N <= 1000000

 

Sample Input-

1

3

Output

A

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?