Time Limit: Java: 2000 ms / Others: 2000 ms
Memory Limit: Java: 65536 KB / Others: 65536 KB
Given a finished number square, we need you to judge whether it is a magic square.
The input contains multiple test cases.
The first line of each case stands an only integer N (0 < N < 10), indicating the degree of the number square and then N lines follows, with N positive integers in each line to describe the number square. All the numbers in the input do not exceed 1000.
A case with N = 0 denotes the end of input, which should not be processed.
For each test case, print "Yes" if it's a magic square in a single line, otherwise print "No".