Baobab#4855

Baobab

1 second
256 megabytes
Very easy

Given an undirected, unweighted graph, your task is to determine whether it is a tree.

Input

The input begins with 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 indicates no edge between them. The main diagonal of the matrix consists of zeros, and the matrix is symmetric about the main diagonal.

Output

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

Examples

Example 1

Loading
Loading