Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
File size: 2,030 Bytes
07f695f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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.

Each game starts with a directed graph that has 2***N** vertices, numbered
from 1 to 2***N**, all of which are initially uncoloured, and **M** edges. The
**i**th edge goes from vertex **Ai** to vertex **Bi**. No two edges connect
the same pair of vertices in the same direction, and no edge connects a vertex
to itself.

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.

Who will win if Alice and Bob play optimally?

### Input

Input begins with an integer **T**, the number of graphs. For each graph,
there is first a line containing the space-separated integers **N** and **M**.
Then **M** lines follow, the **i**th of which contains the space-separated
integers **Ai** and **Bi** .

### Output

For the **i**th graph, print a line containing "Case #**i**: " followed by the
winner of the game, either "Alice" or "Bob".

### Constraints

1 ≤ **T** ≤ 45  
1 ≤ **N** ≤ 500,000  
0 ≤ **M** ≤ 500,000  
1 ≤ **Ai**, **Bi**, ≤ 2***N**  

### Explanation of Sample

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.