- Time limit: 1.00 s
- Memory limit: 128 MB
There are intersections and roads connecting them in the city. Your task is to check if it is possible to get from every intersection to every other intersection by roads.
Input
On the first line of the input there is two integers and : the number of intersections and number of roads. Intersections are numbered .
Then lines follow, each describing one road. Each line has two integers and . This means that there is a road connecting intersection to intersection . All roads are unidirectional.
Output
Print YES
if there exists a route from every intersection to every other intersection, or NO
otherwise.
If the answer is NO
, continue output by printing an example of intersections and such that there exists no route from to .
Limits
Example
Input:
4 5 1 2 2 3 3 1 1 4 3 4
Output:
NO 4 2