- Time limit: 1.00 s
- Memory limit: 512 MB
There are cities and flight connections. Your task is to check if you can travel from any city to any other city using the available flights.
Input
The first input line has two integers and : the number of cities and flights. The cities are numbered .
After this, there are lines describing the flights. Each line has two integers and : there is a flight from city to city . All flights are one-way flights.
Output
Print "YES" if all routes are possible, and "NO" otherwise. In the latter case also print two cities and such that you cannot travel from city to city . If there are several possible solutions, you can print any of them.
Constraints
Example
Input:
4 5 1 2 2 3 3 1 1 4 3 4
Output:
NO 4 2