Welcome to ZOJ
 Contests Information Problems Runs Statistics Ranklist Clarification
48 - ZOJ Monthly, November 2005 - 1006
Gobang

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Gobang is a game played on 15*15 board by two players. One player uses black stones,the other uses the white stones. The game begins in an empty board and two players alternate in placing black stones and white stones. Black always goes first. There are 15 horizontal lines and 15 vertical lines in the board and the stones are placed on the intersections of the lines.Horizontal lines are marked 1, 2, ..., 15 from up to down and vertical lines are marked 1, 2, ..., 15 from left to right.

The objective of this game is to put five stones of the same color consecutively along a horizontal, vertical, or diagonal line.
1. three-three prohibit-step:if there are two groups of three stones of the same color consecutively along a horizontal,vertical,or diagonal,and there are not other color of stones in the head or tail, we call it "three-three prohibit-step".
2. four-four prohibit-step:if there are two groups of four stones of the same color consecutively along a horizontal,vertical,or diagonal,and there are not other color of stones in the head or tail,we call it "three-three prohibit-step".
3. long-link prohibit-step: if more than five stones of the same color are put consecutively we call it "long-link prohibit-step".

The prohibit-step are directed to the player who uses black stones,and the player uses white stones doesn't have it and if black stone player use it in the game,he will be lose the game.

Input Sepcification:

There are several test cases. In the first line, there is a positive integer N, which is the number of the test cases. Then following N test cases, in each test case, there are some lines. The two numbers x and y in each line show the place where the stone will put. If the place had already has stone,we will ingone this line. Each case ended by a negative number.

Output Sepcification:

Print out the winner in a line, if no winner, print out "Draw"

Sample Input:
```2
9 9
8 6
9 8
8 5
9 7
7 2
9 6
3 4
9 5
-1
9 9
9 9
8 8
9 8
8 7
2 3
8 6
4 4
8 5
2 5
8 4
-1
```
Sample Output:
```
Black
White
```

Author: PENG, Peng

Submit    Status