Ainz is a master player of the DMMORPG Yggdrasil. Currently, he is preparing to class up!
The classes in Yggdrasil form a forest: that is, there exists at most 1 path between each pair nodes. However, Ainz finds that someone has used a world item to add some number of extra edges!
Ainz can use the skill «Wish Upon a Star» to remove at most a single edge. He then asks you: is it possible to restore the graph to a forest?
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
Input Specification
The first line of input will contain two space separated integers, and , the number of nodes and edges, respectively.
The next lines will each contain two space separated integers, and , indicating there exists a bidirectional edge from to .
Output Specification
Output YES
if the graph can be restored to a forest by removing at most one edge, and NO
otherwise.
Sample Input 1
5 4
1 2
1 3
4 5
2 3
Sample Output 1
YES
Explanation for Sample Output 1
Removing the edge makes the graph a forest.
Sample Input 2
4 2
1 2
3 4
Sample Output 2
YES
Explanation for Sample Output 2
The graph is already a forest.
Comments
This comment is hidden due to too much negative feedback. Show it anyway.