#K63947. Horizontally Symmetric Grid

    ID: 31866 Type: Default 1000ms 256MiB

Horizontally Symmetric Grid

Horizontally Symmetric Grid

In this problem, you are given a grid consisting of (N) rows, where each row is a string of equal length. Your task is to determine whether the grid is horizontally symmetric. Formally, a grid is horizontally symmetric if for every integer (i) with (0 \le i < \frac{N}{2}), the (i)-th row is identical to the (N-i-1)-th row.

For example, if the grid is ["abc", "def", "abc"], it is symmetric because the first and the last rows are the same, and the middle row does not affect the symmetry. Output "YES" if the grid is symmetric, otherwise output "NO".

inputFormat

The input is given via standard input (stdin). The first line contains an integer (N) representing the number of rows in the grid. The following (N) lines each contain a string representing a row of the grid. It is guaranteed that all rows have the same length.

outputFormat

Print a single line to standard output (stdout) containing "YES" if the grid is horizontally symmetric, or "NO" otherwise.## sample

3
abc
def
abc
YES

</p>