The directed unweighted graph is given. Find out if it has a unique topological ordering of its vertices.
The first line contains the number of vertices n (1 ≤ n ≤ 2 * 10^5
) and the number of edges m (1 ≤ m ≤ 10^5
) in a graph. Each of the next m lines describes the edge of the graph - two numbers, the initial and final vertex.
Print "YES" if the vertices of the graph can be uniquely lexicographically sorted and "NO" otherwise. If it is impossible to sort graph topologically, print -1.