#C7485. Diagonal Matrix Checker

    ID: 51361 Type: Default 1000ms 256MiB

Diagonal Matrix Checker

Diagonal Matrix Checker

You are given a square matrix of size n × n. A matrix is said to be diagonal if all the entries outside the main diagonal are zero. In other words, a matrix \(A\) is diagonal if \(A_{ij} = 0\) for all \(i \neq j\), while the elements on the main diagonal can be any integer.

Your task is to check whether the given matrix is a diagonal matrix.

Note: The input and output should be read from standard input and printed to standard output respectively.

inputFormat

The first line of input contains an integer n (\(1 \leq n \leq 100\)), representing the size of the matrix. The following n lines each contain n space-separated integers, representing the rows of the matrix.

Example:

3
1 0 0
0 5 0
0 0 9

outputFormat

Print True if the matrix is diagonal, otherwise print False.

Example:

True
## sample
3
1 0 0
0 5 0
0 0 9
True

</p>