A Road Problem
View as PDF is going to be late for school! However, this time, it's not his fault. is trying to stop him from making it on time for his test, and as such, will close down intersections in total ( cannot enter closed intersections). The city of Toronto has a total of
intersections, with a total of
roads between them.
He starts at intersection , and the school is at intersection
.
For every intersection closes down, if can still get to school, print YES, otherwise print NO.
It is guaranteed that initially, he can visit all the intersections.
Note that intersections are not roads.
Input Specifications
The first line of input will contain the integer
,
and
, followed by
pairs of integers
a b, meaning that there is a bidirectional road between and
.
There will then be integers
, meaning that the
intersection has been blocked off. Note that
is not distinct.
Queries are persistent.
Output Specifications
Output YES or NO for each query.
Sample Input
3 3 2
1 2
2 3
1 3
2
3
Sample Output
YES
NO
Comments