eolymp
bolt
Try our new interface for solving problems
Problems

Influenza AH1N1

Influenza AH1N1

\includegraphics{https://static.e-olymp.com/content/f4/f4d0ca96e0fd042edaa8eabb4a18c621893da86d.jpg} Any epidemic is dangerous. And the more an epidemic of highly communicable diseases such as influenza. Therefore, governments of almost all countries are developing plans for special events in case of epidemics. One of the most effective measures in the epidemic is to isolate the diseased. At the same time across the country may have to isolate the entire city (what to do within each of the isolated city, city council decides to let this city). It is obvious that in case of isolation of the city to keep all communication between the other cities. Naturally, if the communication is not saved, you need to build new roads (preferably as little as possible). President of a country with a developed network of roads led your team to assess the situation. He asked to determine whether the communication will remain between all the cities (we assume that in this country, the communication between all the cities beginning of time), if one isolate any city (ie, blocking all roads leading to it). However, if there is at least one city, which violates the exclusion of communication is necessary to determine if there is enough to build just one way that the insulation does not violate any city communications. Since information on all the roads of the country is strategic, the president does not have a network of roads the names of cities, but simply to number them. \InputFile In the first line through the gap through two integers (\textbf{N} - number of cities, \textbf{2} ≤ \textbf{N} ≤ \textbf{20000} and \textbf{M} - number of roads, \textbf{1} ≤ \textbf{M} ≤ \textbf{200000}). Thus two cities can only connect one way. Next M lines, each containing two integers through space - number of cities connected by road. \OutputFile If the exclusion of any city with the construction of not more than one road is possible, in a single line of text to give \textbf{YES}, otherwise the line to withdraw \textbf{NO}. If the possibility of isolation of any city to build only one road, then through the gap to bring the number \textbf{1}.
Time limit 3 seconds
Memory limit 64 MiB
Input example #1
4 4
1 2
2 3
1 3
3 4
Output example #1
YES 1