Forest plantations#4818

Forest plantations

1 second
64 megabytes
Very easy

An undirected, unweighted graph is provided.

Your task is to determine if this graph is a tree.

Input

The first line of the input contains a single natural number (N \leq 100), representing the number of vertices in the graph. Following this, there are lines, each containing numbers, which form the adjacency matrix of the graph. In the -th row and -th column, a indicates that vertices and are connected by an edge, while a means there is no edge. The main diagonal of the matrix consists of zeros, and 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