|
<p> |
|
Alice and Bob are spending the day in the local library, learning about 2-player zero-sum games. One of the books they're reading, "Grundy Numbers For Fun And Profit" by Nim Nimberly, |
|
has an interactive insert with a bunch of graphs and instructions for a game where the players take turns colouring each graph's vertices. |
|
</p> |
|
|
|
<p> |
|
Each game starts with a directed graph that has 2*<strong>N</strong> vertices, numbered from 1 to 2*<strong>N</strong>, all of which are initially uncoloured, and <strong>M</strong> edges. |
|
The <strong>i</strong>th edge goes from vertex <strong>A<sub>i</sub></strong> to vertex <strong>B<sub>i</sub></strong>. No two edges connect the same pair of vertices |
|
in the same direction, and no edge connects a vertex to itself. |
|
</p> |
|
|
|
<p> |
|
Alice goes first and colours vertices 1 and 2. She must colour one of these two vertices black, and the other one white. Bob then takes his turn and similarly colours vertices 3 and 4, one of them black and the other one white. |
|
This continues with Alice colouring vertices 5 and 6, Bob colouring 7 and 8, and so on until every vertex is coloured. |
|
At the end of the game, Alice wins if there are no edges going from a black vertex to a white one. Bob wins if such an edge exists. |
|
</p> |
|
|
|
<p> |
|
Who will win if Alice and Bob play optimally? |
|
</p> |
|
|
|
<h3>Input</h3> |
|
<p> |
|
Input begins with an integer <strong>T</strong>, the number of graphs. |
|
For each graph, there is first a line containing the space-separated integers <strong>N</strong> and <strong>M</strong>. |
|
Then <strong>M</strong> lines follow, the <strong>i</strong>th of which contains the space-separated integers |
|
<strong>A<sub>i</sub></strong> and <strong>B<sub>i</sub></strong> . |
|
</p> |
|
|
|
|
|
<h3>Output</h3> |
|
<p> |
|
For the <strong>i</strong>th graph, print a line containing "Case #<strong>i</strong>: " followed by the winner of the game, either "Alice" or "Bob". |
|
</p> |
|
|
|
|
|
<h3>Constraints</h3> |
|
<p> |
|
1 ≤ <strong>T</strong> ≤ 45 <br /> |
|
1 ≤ <strong>N</strong> ≤ 500,000 <br /> |
|
0 ≤ <strong>M</strong> ≤ 500,000 <br /> |
|
1 ≤ <strong>A<sub>i</sub></strong>, <strong>B<sub>i</sub></strong>, ≤ 2*<strong>N</strong> <br /> |
|
</p> |
|
|
|
|
|
<h3>Explanation of Sample</h3> |
|
<p> |
|
For the first graph, Alice can color vertex 1 white and vertex 2 black. Since all edges start at vertex 1, Alice will win. |
|
|
|
For the second graph, Alice can't control the color of vertex 3. If Bob makes it white, then one of the two edges must be from a black vertex to a white vertex, so Bob wins. |
|
</p> |
|
|