Hectic Game
44% Success4485 Attempts20 Points1s Time Limit256MB Memory1024 KB Max Code

Alice and Bob are playing a hectic game in which there are a total of $$N$$ tasks each consisting of a start time $$S_i$$ and end time $$E_i$$.

Both players take alternate turns, Alice plays first. In each turn, a player chooses the maximum number of tasks that are non-overlapping as both Alice and Bob can perform only one task at a time. In the next turn, the other player will choose the maximum number of tasks that are non-overlapping from the remaining tasks and so on.

Now, both the players will take XOR (Exclusive - OR) of the total tasks count value obtained in each of their turns. Let the value be $$A$$ for Alice and $$B$$ for Bob. Now, If $$A \gt B$$, Alice wins. If $$B \gt A$$, Bob wins. If $$A = B$$, it's a tie. Find out the winner?

Note: The ending time $$E_i$$ for each selected task in each turn should be as less as possible, e.i. if the given tasks are $$[1\;5]$$, $$[3\;8]$$, $$[6\;10]$$, $$[9\;15]$$, Alice can choose maximum 2 tasks in 3 ways as $$[1\;5]$$, $$[6\;10]$$ or $$[1\;5]$$, $$[9\;15]$$ or $$[3\;8]$$, $$[9\;15]$$. Alice will choose $$[1\;5]$$, $$[6\;10]$$ as the ending time for each selected task is as less as possible in this case.

Input Format

The first line of the input will be $$T$$, the total number of test cases.

The first line of each test case will be $$N$$, the total number of tasks.

Then $$N$$ lines follow each consisting of two space-separated integers $$S_i$$ and $$E_i$$ the start time and the end time.

Output Format

For each test case print the respective result Alice, Bob or Tie.

Constraints

\(1 \le T \le 10\)

\(1 \le N \le 10^3\)

\(1 \le S_i \le E_i \le 10^9\)

Examples
Input
1
5
1 2
1 3
4 5
3 4
1 5
Output
Alice
Explanation

Initially, there are maximum 2 tasks Alice can choose i.e. $$[1\;2]$$ and $$[3\;4]$$. From the remaining tasks, Bob can choose maximum 2 tasks i.e. $$[1\;3]$$ and $$[4\;5]$$. Now, Alice chooses the 1 last task i.e. $$[1\;5]$$.

$$A$$ = 2 ^ 1 = 3

$$B$$ = 2

$$A > B$$ thus, Alice wins.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading Editor...
Results