Transitivity of a graph
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Undirected graph without loops and multiple edges is called transitive, if from conditions that vertices and are connected with an edge, vertices and are connected with an edge and all three vertices and are different, implies that vertices and are connected with an edge.
Verify that a given undirected graph is transitive.
Input
The first line contains the number of vertices and edges of the graph. Then lines are given - the list of edges.
Output
Print "YES" or "NO" — the answer to the question about transitivity of a graph.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 2K
Acceptance rate 26%