An undirected graph without loops and multiple edges is given by an adjacency matrix. Determine whether this graph is a tree.
The first line contains the number of vertices n (1≤n≤100) in the graph. Then, an adjacency matrix of size n×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.
Print "YES" if the graph is a tree, and "NO" otherwise.