Is it a Tree?#977

Is it a Tree?

1 second
128 megabytes
Very easy

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

Input

The first line contains the number of vertices (1 \le n \le 100).

Then, an adjacency matrix of size n \times n is given, where denotes the presence of an edge, and denotes 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