Redirecting to
NADOS

Number Game

Alice and Bob play a game.

They start with a number n and play in turns. In each turn, a player can make any one of the following moves:
1. Divide n by any of its odd divisors greater than 1.
2. Subtract 1 from n if n is greater than 1.


Divisors of a number include the number itself.
The player who is unable to make a move loses the game.
Alice moves first. Determine the winner of the game if both of them play optimally.
Input Format
The first line contains integer t, no. of test cases.
Each of next t lines contain a number n.
Output Format
Print the winner ALICE or BOB.
Question Video
Constraints
1<= t <= 100
1<= n <= 10^9
Sample Input
7
1
2
3
4
5
6
12
Sample Output
BOB
ALICE
ALICE
BOB
ALICE
BOB
ALICE



  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name