Transitivity of a graph#3988

Transitivity of a graph

1 sekunda
128 megabajtów
Łatwe

Undirected graph without loops and multiple edges is called transitive, if vertices and are connected with an edge, vertices and are connected with an edge, and all three vertices , , and are different, then vertices and must also be connected with an edge.

Verify that a given undirected graph is transitive.

Dane wejściowe

The first line contains the number of vertices and edges m~(3 \le n \le 100, 0 \le m \le (n \cdot (n - 1)) / 2) of the graph. Then lines are given - the list of edges.

Dane wyjściowe

Print "YES" or "NO" — the answer to the question about transitivity of a graph.

Przykłady

Przykład 1

Loading
Loading

Przykład 2

Loading
Loading