eolymp
bolt
Try our new interface for solving problems
Problems

Оксюморон

Оксюморон

Time limit 1 second
Memory limit 122 MiB

Three square matrices of equal size are given. Verify that the third matrix is the product of the first and the second (in that order).

Input data

Состоит из нескольких тестов. Каждый тест начинается с размера матриц n (1n500). Далее следует описание трёх матриц, каждая из которых описывается n строками по n целых чисел каждая. Все входные числа не превосходят 10^9. Последний тест содержит n = 0 и не обрабатывается.

Output data

Print YES if the third matrix is the product of the first and the second and NO otherwise.

Examples

Input example #1
2
1 0
0 1
1 0
0 1
1 0
0 1
2
1 0
0 1
1 0
0 1
1 0
0 0
0
Output example #1
YES
NO