Hectic Game

4

4 votes
Algorithms, Bit manipulation, Easy, Greedy Algorithms, Hash Maps
Problem

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

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 for Alice and for Bob. Now, If , Alice wins. If , Bob wins. If , it's a tie. Find out the winner?

Note: The ending time  for each selected task in each turn should be as less as possible, e.i. if the given tasks are , , , , Alice can choose maximum 2 tasks in 3 ways as , or , or , . Alice will choose , 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 , the total number of test cases.

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

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

Output Format

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

Constraints

Sample Input
1
5
1 2
1 3
4 5
3 4
1 5
Sample Output
Alice
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Initially, there are maximum 2 tasks Alice can choose i.e. and . From the remaining tasks, Bob can choose maximum 2 tasks i.e. and . Now, Alice chooses the 1 last task i.e. .

= 2 ^ 1 = 3

= 2

thus, Alice wins.

Editor Image

?