Codeforces Round 237 (Div. 2)
A
Valera and X
Codeforces
1000
原题
←B →
翻译中…

Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have a test on alphabet today. At the test Valera got a square piece of squared paper. The length of the side equals $*n*$ squares ($*n*$ is an odd number) and each unit square contains some small letter of the English alphabet.

翻译中…

Valera needs to know if the letters written on the square piece of paper form letter "X". Valera's teacher thinks that the letters on the piece of paper form an "X", if:

翻译中…
  • on both diagonals of the square paper all letters are the same;
  • all other squares of the paper (they are not on the diagonals) contain the same letter that is different from the letters on the diagonals.
翻译中…

Help Valera, write the program that completes the described task for him.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ ($3 ≤ *n* < 300$; $*n*$ is odd). Each of the next $*n*$ lines contains $*n*$ small English letters — the description of Valera's paper.

翻译中…

Output

翻译中…

Print string "YES", if the letters on the paper form letter "X". Otherwise, print string "NO". Print the strings without quotes.

翻译中…

样例

Input #1
5
xooox
oxoxo
soxoo
oxoxo
xooox
Output #1
NO
InputCopy OutputCopy
Input #2
3
wsw
sws
wsw
Output #2
YES
InputCopy OutputCopy
Input #3
3
xpx
pxp
xpe
Output #3
NO
InputCopy OutputCopy
题目信息
题号
404A
时间限制
1 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。