SDE Path

Is the Matrix Symmetric

Easy

Is the Matrix Symmetric

Check whether a square grid equals its own transpose.

Input format

The first line has two integers R and C (with R = C, a square matrix). Each of the next R lines has C space-separated integers describing one row.

Output format

Print true if the matrix equals its own transpose (g[i][j] == g[j][i] for all i, j), otherwise false.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
2 2
1 2
2 1
Expected output
true
Example 2
Input
2 2
1 2
3 4
Expected output
false