48 - ZOJ Monthly, November 2005 - 1006
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.
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.
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.
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 -1Sample Output:
Author: PENG, Peng