Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/matritsa-simmetrikmi

Symmetric matrix

Easy 1000 ms 128 MB 33%
Share

A square integer matrix of size $n \times n$ is given. If the matrix is symmetric about its main diagonal ($a_{i,j} = a_{j,i}$ for all $i, j$), print YES, otherwise print NO.

Checking whether a square matrix is symmetric about the main diagonal

Input

The first line contains two equal positive integers $n$ and $n$. Each of the next $n$ lines contains $n$ integers.

Output

YES or NO.

Note

$1 \le n \le 200$
$-1000 \le a_{i,j} \le 1000$

Examples

Input #1
3 3
1 2 3
2 5 6
3 6 9
Output #1
YES
Input #2
2 2
1 2
3 4
Output #2
NO

Sign in to submit a solution

Signing up is free and takes a minute.