文理学院程序设计在线练习


Gobang

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 6   Accepted Submission(s): 2
Problem Description

Lily and Cindy is playing Gobang ,which also called as five-in-a-row. Who makes continuous five piece in a line will win.
Halfway through chess, Lily's mother told her to go home for dinner.
After eating, Lily came back and found it was a little different.
Lily wants to know if Cindy has changed the chessboard. To simplify the Problem, if it satisfies the following circumstances, it is considered that Cindy cheated.
1. Somebody has already won.
2. The absolute difference between the number of black and white chess pieces is greater than one.

Input

The first line of the input gives the number of test cases T , T test cases follow.
There are 20 lines in each data set, each of which includes 20 characters. Each character represents the color of a tile as follows.
‘.’ – empty
‘x’ – Cindy's Black chess piece
‘o’ – Lily's White chess piece
T <= 2000

Output

If Cindy cheated , output "No" , else output "Yes".

Sample Input
1
....o.............x.
...o................
..o.................
.o..................
o...................
....x.............x.
....................
....................
....................
....................
....x.............x.
....................
....................
....................
....................
....x..........o....
................o...
....................
....................
....................
Sample Output
No
Hint

In Sample test, Lily has already win.

Source

2018市赛