Alice and Bob are good friends, as in every other storyline. One day Alice and Bob are playing an interesting game. The game is played on a directed graph with n vertices and m edges, Alice and Bob have exactly one chess piece each. Initially, Bob’s chess piece is placed on vertex x, while Alice’s chess piece is placed at vertex y. Bob plays first, then Alice, then Bob, then Alice and so on.
During each move, the player must move his/her chess piece from the vertex his/her chess piececurrently at to an adjacent vertex, by traveling through exactly one directed edge.(Remember that the game is played on a directed graph.) If someone can’t make such a move, he/she will be considered to lose the game.
There’s one additional rule: at any time, if Bob and Alice’s chess pieces are at the same vertex,then Alice is consider to be the winner and the game ends up immediately.
Now you are given the initial situation, could you determine who is the winner? Please note that neither Bob nor Alice will make any mistakes during the game, i.e. they both play optimally. In case that the game never ends up, Bob is considered to be the winner.
The first line of the input gives the number of test cases, T. T test cases follow.
For each test case, the first line contains two integers n and m ( $2 ≤ n ≤ 100, 1 ≤ m ≤ n × (n − 1)$ ).
Next m lines, each line contains two integers b and e, indicating there is one directed edge from vertex
b to vertex e. Last line contains two integers x and y ( $1 ≤ x, y ≤ n, x \ne y$ ), which are Bob and Alice’s
initial position. The graph contains no self-loops or duplicate edges.
For each test case output one line ‘Case #x: y’, where x is the case number (starting from 1) and y
is ‘Yes’ (without quotes) if Bob can win or the game never ends up, otherwise ‘No’ (without quotes).
考虑采用 $dp[i][j][k]$ 表示Alice在点i而Bob在点j的情况，k为0或者1代表Bob或者Alice行动，值表示此状态下Alice是否必胜（Bob是否必败）；则题目所求即为$dp[x][y]$的值。
1.棋子重合, $dp[i][i]=1$ 和 $dp[i][i]=1$ ( $1 ≤i≤ n$ )
2.有一人无法行动，即对于所有出度为0的点 $v$ ， $dp[v][i]=1,dp[i][v]=0$
一种思路是使用记忆化搜索，即从 $dp[x][y]$ 出发模拟两人的策略：
若对于所有可达状态 $dp[v][j]=1$ ，则 $dp[i][j]=1$ ，否则 $dp[i][j]=0$
若对于所有可达状态 $dp[i][v]=0$ ，则 $dp[i][j]=0$ ，否则 $dp[i][j]=1$
对于确定状态 $dp[i][j]=1$ ，反图中所有可达状态 $dp[i][v]=1$ ，这是Alice主动选择的结果。
对于确定状态 $dp[i][j]=1$ ，仅当反图中可达状态 $dp[v][j]$ 的后续状态均为Alice的必胜态，即总状态数量上等于 $v$ 的出度时，有 $dp[v][j]=1$ ，这是Bob被动决定的结果。
扩展后若有 $dp[x][y]=1$ 则Alice胜，否则Bob胜。