创建于 2026/07/16 · 更新于 2026/07/16
You are given a tree with vertices. Each edge has an initial direction. There is a token initially placed on vertex .
There is also a set of terminal vertices.
Two players, Alice and Bob, play alternately. Alice moves first.
In one turn, the current player performs the following two operations:
If, after both operations of a player's turn are completed, the token is on a vertex in , the game ends.
Alice wants the game to end. Bob wants the game to never end.
Assuming both players play optimally, determine whether Alice can force the game to end from the initial position.
It is guaranteed that every edge incident to vertex is initially directed towards vertex and .
The input contains multiple test cases.
The first line contains an integer (), the number of test cases.
For each test case, the first line contains an integer ().
The second line contains an integer (), the number of terminal vertices.
The third line contains distinct integers (). These vertices form the terminal set .
Each of the next lines contains two integers (, ), describing an edge initially directed from to .
The sum of over all test cases does not exceed .
For each test case, print one line.
If Alice can force the game to end from the initial position, print Alice. Otherwise, print Bob.
4
2
1
2
2 1
3
1
3
2 1
3 2
3
1
2
2 1
2 3
4
1
4
2 1
3 2
3 4
Alice
Bob
Alice
Bob