#C10259. Symmetric Matrix Checker

    ID: 39444 Type: Default 1000ms 256MiB

Symmetric Matrix Checker

Symmetric Matrix Checker

This problem requires you to determine whether a given n × n matrix is symmetric. A matrix is considered symmetric if, for every pair of indices i and j, the equality \(A[i][j] = A[j][i]\) holds.

You will be given multiple test cases. For each test case, the first input is an integer n representing the dimension of the matrix, followed by n lines with n integers each, separated by spaces. Your task is to output "YES" if the matrix is symmetric, and "NO" otherwise.

Note: Use appropriate methods to read from standard input and write to standard output.

inputFormat

The input begins with an integer T denoting the number of test case inputs. Each test case is formatted as follows:

  1. An integer n specifying the size of the matrix.
  2. n lines follow, each containing n space-separated integers representing the rows of the matrix.

For example:

3
1 2 3
2 4 5
3 5 6

outputFormat

For each test case, print a single line containing "YES" if the matrix is symmetric and "NO" if it is not.

## sample
1
3
1 2 3
2 4 5
3 5 6
YES

</p>