Now write a program to determine the outcome of a Tic-Tac-Toe game. You will be given the number of moves N, then a series of N moves. Each move is a (x, y) position. First the black player(0) will scan through the move until it finds a legal move, then he plays the move. Next the white player(1) will do the same. Note that any illegal moves are simply disregarded. This process stops when any player wins, or there are no more moves left, and it is a draw. For example, if the moves are (-1, 100), (0, 0), (0, 0), (20, 30), (1, 1) then the first move of black is (0, 0), and the first move of white is (1, 1).
Your program must determine who wins or it is a draw. The illegal moves are not counted in the number of moves, so the moves made by blacks are always 1, 3, 5, 7, 9, and the white is always 2, 4, 6, 8.
Input format
The first line contains number 0≤N≤1000. There are N lines followed, each of them contains two integers x and y, indicating the current player make a move on (x, y).
Output format
Print a line contains "Black wins." or "White wins." or "There is a draw.".
Sample Input
3
1 1
0 0
0 2
Sample Output
There is a draw.
Test Data
You can download the test data (which JudgeGirl uses) from here.
Task Description
Now write a program to determine the outcome of a Tic-Tac-Toe game. You will be given the number of moves N, then a series of N moves. Each move is a (x, y) position. First the black player(0) will scan through the move until it finds a legal move, then he plays the move. Next the white player(1) will do the same. Note that any illegal moves are simply disregarded. This process stops when any player wins, or there are no more moves left, and it is a draw. For example, if the moves are (-1, 100), (0, 0), (0, 0), (20, 30), (1, 1) then the first move of black is (0, 0), and the first move of white is (1, 1).
Your program must determine who wins or it is a draw. The illegal moves are not counted in the number of moves, so the moves made by blacks are always 1, 3, 5, 7, 9, and the white is always 2, 4, 6, 8.
Input format
The first line contains number 0≤N≤1000. There are N lines followed, each of them contains two integers x and y, indicating the current player make a move on (x, y).
Output format
Print a line contains "Black wins." or "White wins." or "There is a draw.".
Sample Input
3 1 1 0 0 0 2
Sample Output
There is a draw.
Test Data
You can download the test data (which JudgeGirl uses) from here.