Author: | A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Rectangular jigsaw puzzle consists of two pieces.
Each piece is a 4-connected set of square cells,
each cell represented by character 'X
' or 'O
'.
Your program must determine whether it is possible to separate puzzle pieces by moving either of them in vertical or horizontal direction.
In the first sample it is possible to separate pieces
by moving 'X
' piece up and/or 'O
' piece down.
First line of input contains two integers W H. Following H lines contain W characters each — puzzle representation.
Output must contain a single string YES
or NO
.
1 ≤ W, H ≤ 100. Each piece contains at least one cell.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|