OpenJudge

2:Chess

总时间限制:
1000ms
内存限制:
65536kB
描述

There is a special chess game. In the game, two people play with go pieces (“x” and “o”)on a 4×4 go board. The “x” piece plays first, and players alternate in placingtheir pieces on an empty cell. The winner is the first player to get an unbroken row of four pieces horizontally, vertically, or diagonally, as shownbelow:

In Figure 1,player with piece ‘x’ win the game.

In Figure 2,player with piece ‘o’ win the game.

In Figure 3,there is a tie.

XXX often plays that game with his girlfriend. Sometimes he wants to win the game in order to prove his cleverness. Sometimes he wants to lose the game to let his girlfriend happy. Sometimes he wants to end in a tie (which means that no one wins when there is no empty cell on the board), so that the relationship between his girlfriend and him can be improved.

Here is thequestion: given the status of middle stage of the board, judge whether XXX canget the result he expected whatever how his girlfriend places her pieces later on.

输入
The input begins with a line containing an integer, indicating the number of test cases. There are no more than 100 test cases.
For each case, the first line is either “WIN”, “LOSE” or “TIE”, indicating the expectation result of XXX. The next four lines give a 4*4 matrix indicating the status of middle stage of the board. The matrix is formed with the character “x” (“x” piece), “o” (“o” piece) and“.” (empty cell). There are 6 to 10 pieces on the board. The number of “x” pieces is equals to or one more than the number of “o” pieces. It is XXX’s turn to place the piece. It is promised that no one has won the game in the given board.
输出
For each test case, output a string “YES” or “NO” in a line to tell XXX if he can achieve his expectation.
样例输入
3
LOSE
.o.x
.o.o
x...
.x..
WIN
.o..
xxoo
x..o
x..x
TIE
...o
xo.x
x.xo
o...
样例输出
NO
NO
YES
全局题号
5138
添加于
2016-07-22
提交次数
0
尝试人数
0
通过人数
0