Is it a Tree?#494

Is it a Tree?

1 second
128 megabytes
Easy (≈1000)

An undirected graph without loops and multiple edges is given by an adjacency matrix. Determine whether this graph is a tree.

Input

The first line contains the number of vertices n~(1 \le n \le 100) in the graph. Then, an adjacency matrix of size n \times n is given, where indicates the presence of an edge, and indicates its absence. The matrix is symmetric with respect to the main diagonal.

Output

Print "YES" if the graph is a tree, and "NO" otherwise.

Examples

Example 1

Loading
Loading