You are given a graph with n vertices numbered from 1 to n. The graph contains m edges. However, for every edge, only its two endpoints are given. The direction of each edge is unknown and may be chosen arbitrarily.
You are also given an ordering of all vertices representing a traversal.
Determine whether it is possible to assign a direction to every edge such that the given ordering is a valid traversal of the graph.
Print "YES" if such an assignment exists; otherwise print "NO".
1 ≤ n ≤ 2 × 10^5 n - 1 ≤ m ≤ 2 × 10^5 1 ≤ ui, vi ≤ n The traversal contains every vertex exactly once.