There are $$$N$$$ lawyers. Each lawyer has been charged with committing a fraudulent offense. These $$$N$$$ lawyers try to defend each other and make sure they are acquitted.
Lawyer $$$A$$$ can defend lawyer $$$B$$$ if and only if lawyer $$$B$$$ trusts lawyer $$$A$$$, and there are $$$M$$$ such pairs $$$(A, B)$$$. Note that, if lawyer $$$B$$$ trusts lawyer $$$A$$$, it does not imply that lawyer $$$A$$$ trusts lawyer $$$B$$$.
Each lawyer is very hard-working, so one lawyer can defend any number of others.
Each lawyer is very talented, so anyone who receives at least one defense is unconditionally acquitted. With one exception: if lawyer $$$A$$$ defends lawyer $$$B$$$ and lawyer $$$B$$$ defends lawyer $$$A$$$, it seems very suspicious, and both are found guilty.
Determine whether it is possible or not for all lawyers to be acquitted together.
The first line contains two integers $$$N$$$ and $$$M$$$, the number of lawyers and the number of trust relationships ($$$1 \le N, M \le 200\,000$$$).
The next $$$M$$$ lines describe trust relations. The $$$i$$$-th of these $$$M$$$ lines contains two different integers $$$A_i$$$ and $$$B_i$$$, which means lawyer $$$B_i$$$ trusts lawyer $$$A_i$$$, and so lawyer $$$A_i$$$ can defend lawyer $$$B_i$$$. There are no such $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le M$$$, $$$i \ne j$$$) that $$$A_i = B_i$$$ and $$$A_j = B_j$$$.
Print "YES" (without quotes) if it is possible for all lawyers to be acquitted together. Print "NO" (without quotes) otherwise.
3 3 1 2 2 3 3 1
YES
4 6 1 2 1 3 1 4 2 3 2 4 3 4
NO
4 4 1 2 2 1 3 4 4 3
NO