The directed graph is called transitive, if for its any three distinct vertices and from the fact that there are edges from to and from to it follows that there is an edge from to .
Check that the given directed graph is transitive.
The first line contains the number of vertices in the graph. The next lines contain the adjacency matrix of the graph.
Print "YES" if graph is transitive and "NO" otherwise.