Problems
Is it a Tree?
Is it a Tree?
An undirected graph without loops and multiple edges is given by an adjacency matrix. Determine whether this graph is a tree.
Input data
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 1 indicates the presence of an edge, and 0 indicates its absence. The matrix is symmetric with respect to the main diagonal.
Output data
Print "YES" if the graph is a tree, and "NO" otherwise.
Examples
Input example #1
3 0 1 0 1 0 1 0 1 0
Output example #1
YES