Given an undirected connected graph with vertices and
edges, Alice and Bob are playing a chasing game on the graph. The game is played for
times with different starting positions.
In the -th round, Alice starts at vertex
, and Bob starts at vertex
. Both players always know each other's current positions. The rules of the game are as follows:
- The two players take turns, with Bob moving first in each round.
- Bob can move along any number of edges (even
, meaning he can stay in the current vertex) during his turn, but he cannot pass through the vertex where Alice currently is.
- Alice can move along at most one edge (or stay in place) during her turn.
- If Alice ends her move on the vertex where Bob currently is, Alice wins.
Alice tries her best to catch Bob to win the game, and Bob tries his best to avoid being caught forever. Your task is to determine, for each game, whether Alice can guarantee a win in finite moves, no matter how optimally Bob plays.
Input
The first line contains three integers ,
,
(
), the number of vertices, edges, and games respectively.
The next lines each contain two integers
and
, (
), indicating an undirected edge between vertices
and
. The graph is connected, no self-cycle, and there is at most one edge between a pair of vertices.
The next lines each contain two integers
and
, (
), representing Alice and Bob's starting positions in one game.
Output
Output lines. For each game, print
Yes
if Alice can guarantee a win in finite moves, otherwise print No
.
Constraints
Subtask | Points | Additional constraints |
---|---|---|
No additional constraints |
Sample Input
8 10 3
1 2
2 3
3 4
4 1
6 4
5 6
6 7
8 7
8 5
8 6
6 4
4 5
5 7
Sample Output
No
Yes
No
Explanation
The graph is shown as above.
- For the
st game, Alice starts from
and Bob starts from
. Bob can move to the vertex
. When Alice arrives at a vertex ajacent to
, Bob can move to one of the vertices in
, which is not adjacent to Alice. Thus, Alice cannot reach Bob in finite moves.
- For the
nd game, when Alice moved to the vertex
, she can catch Bob in one step, not matter Bob is at vertex
,
or
.
Comments