#C5346. Valid Word Square

    ID: 48985 Type: Default 1000ms 256MiB

Valid Word Square

Valid Word Square

Given an integer n and a list of n words, determine if the words form a valid word square.

A word square is valid if for every valid indices \(i\) and \(j\), the condition
\(words[i][j] = words[j][i]\) holds true, and every word must have exactly n characters.

Note that if n = 0 (an empty list), the square is considered valid.

inputFormat

The first line contains an integer n representing the number of words. The next n lines each contain a word.

outputFormat

Output a single line: True if the words form a valid word square, or False otherwise.

## sample
4
ball
area
lead
lady
True