Description:
A Boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4 x 4 matrix which has the parity property:
The sums of the rows are 2, 0, 4 and 2. The sums of the columns are 2, 2, 2 and 2. In this homework, you are asked to write a program that reads in a matrix to a multiple-subscripted array and checks if it has the parity property.
Input:
The first line of each test case contains one integer n (n<100), representing the size of the matrix. On the next n lines, there will be n integers per line. No other integers than 0 and 1 will occur in the matrix.
Output:
For the matrix in the input, print one line. If the matrix already has the parity property, print "Yes", print "No" otherwise.
Sample Input I:
4
1 0 1 0
0 0 0 0
1 1 1 1
0 1 0 1
Sample Output I:
Yes
Sample Input II:
4
1 0 1 0
0 1 1 0
1 1 1 1
0 1 0 1
Sample Output II:
No