LearnPy Hub
← Arena
EasyRating 900

Identity Matrix?

Print YES if the square grid has 1s on the main diagonal and 0s everywhere else.

Input

n, then n rows.

Output

YES or NO.

Sample 1

Input
3
1 0 0
0 1 0
0 0 1
Output
YES

Sample 2

Input
2
1 0
1 1
Output
NO
solution.py
Output appears here
Identity Matrix? · Python Arena problem · LearnPy Hub