QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 512 MB Points totaux : 100

#15048. Interval Number Picking Game

Statistiques

This is a giveaway problem.

Alice and Bob are playing a game. The game is as follows: Given $N$ intervals, where the $i$-th interval is $[l_i, r_i]$ (inclusive). Alice and Bob take turns (Alice goes first). In each turn, a player can choose an interval $i$ that has not been deleted yet, such that: 1. Interval $i$ contains interval $j$. And all intervals $j$ that have not been deleted are also deleted. The player who cannot make a move loses the game.

Given $N$ and these $N$ intervals, determine who wins under optimal play, Alice or Bob. To prevent code that outputs results randomly, this problem contains multiple test cases.

The test data guarantees that any two intervals only have containment or non-overlapping relationships. It is also guaranteed that all $l_i, r_i$ are distinct.

Key hint for the giveaway: Given a tree, each time you delete an edge, all nodes in the subtree away from the root are deleted. The player who cannot make a move loses. The following theorem applies: The SG value of a leaf node is 0, and the SG value of an internal node is the XOR sum of the SG values of its children plus 1.

Input

The first line contains $T$ ($T \le 10$), representing the number of test cases. For each test case, the first line contains $N$, the number of intervals. The next $N$ lines each contain two positive integers $l_i, r_i$ ($l_i \le r_i$), representing the range of the $i$-th interval.

Output

For each test case, output the result. If Alice wins, output "Alice", otherwise output "Bob" (without quotes).

Examples

Input 1

1
2
1 4
2 3

Output 1

Alice
Case $N$ $l_i, r_i$
0 10 .h=10 $\le 1000000007$
1
2 100
3
4 1000
5
6 50000
7
8
9

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.