QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 1024 MB

#23968. Xs and Os

İstatistikler

There is a grid with $N$ rows and $N$ columns. The cell in the $i$-th row from the top ($1 \le i \le N$) and the $j$-th column from the left ($1 \le j \le N$) is denoted as cell $(i, j)$. A character $C_{i,j}$ is written in cell $(i, j)$, where $C_{i,j}$ is either o or x.

Output Yes if there exists a row in which all characters are the same, or a column in which all characters are the same; otherwise, output No.

Constraints

  • $1 \le N \le 100$.
  • $C_{i,j}$ is either o or x ($1 \le i \le N$, $1 \le j \le N$).
  • $N$ is an integer.

Input

The input is given in the following format:

N
C_{1,1} C_{1,2} ... C_{1,N}
C_{2,1} C_{2,2} ... C_{2,N}
...
C_{N,1} C_{N,2} ... C_{N,N}

Output

Output Yes if there exists a row in which all characters are the same, or a column in which all characters are the same; otherwise, output No.

Do not output anything other than the answer. (Do not output prompt sentences or anything similar.)

Examples

Input 1

3
o x x
o o x
o x o

Output 1

Yes

Note 1

$C_{1,1} =$ o, $C_{2,1} =$ o, $C_{3,1} =$ o, so all characters in the $1$-st column are o. Therefore, output Yes.

Input 2

4
o x x x
x o x x
x x o x
x x x o

Output 2

No

Note 2

  • There is no row in which all characters are the same.
  • There is no column in which all characters are the same.

Therefore, output No.

Input 3

6
x x o o x x
x o x x o x
o x x x x o
o x x x x o
x o x x o x
x x o o x x

Output 3

No

Note 3

  • There is no row in which all characters are the same.
  • There is no column in which all characters are the same.

Therefore, output No.

Input 4

10
o x o o o x o x o x
o o x o o x o o o x
x o o x o o o x x x
o o o x o o x o x x
o o o o o o o x o x
x x x x x x x x x x
o o o x o o o o o x
o o o x o o o o o x
o o o x o o x x o x
o x o o o o x o o x

Output 4

Yes

Note 4

In the $10$-th column and the $6$-th row, all characters are the same in each, so output Yes.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.