There are n courses labelled 0..n-1. You are given m prerequisite rules. A rule a b means course a requires course b to be completed first.
You can finish all the courses if and only if it is possible to order them so that every course comes after all of its prerequisites. Decide whether that is possible.
Input format
Line 1: two integers n and m.
The next m lines each contain two integers a b, meaning course a requires course b first.
Output format
Print YES if every course can be finished, otherwise print NO.
Constraints
- 1 <= n <= 100000
- 0 <= m <= 200000
- 0 <= a, b <= n - 1
- A rule may repeat, and a rule with a == b (a course requiring itself) is allowed and makes completion impossible.