In a certain place in Southwestern Europe, the name of which I do not wish to recall, not so long ago there were cities connected by unidirectional roads. There may be several roads connecting one city to another, or even to itself. As a homework assignment for your geography class, you need to compute the number of paths of length exactly two between each pair of cities. However, you were busy and didn't complete the assignment, so now you are checking answers from your friend. You want to verify that your friend's answers are correct before using them.
The input consists of several test cases, separated by a single blank line. Each test case begins with a line containing the integer (1 \leq n \leq 1000). The next lines each contain elements; element of line is the number of roads from city to city (a number from to , inclusive). Then, lines follow, each containing elements, where element of line is your friend's answer for the number of length- paths from city to city ; it will be an integer from to inclusive.
The test cases end with a line containing only the number (also preceded by a blank line).
Note: Large input file; use fast I/O routines.
For each test case, your program should output a line. This line should be YES if your friend's solution is correct, and NO otherwise.
Example 1