Board Game
Two players are engaged in a simple game on a chessboard with dimensions N
by M
. The board's rows are numbered from 1
to N
, and the columns from 1
to M
. The first player controls a white pawn, initially positioned at (RW, CW)
, while the second player controls a black pawn, starting at (RB, CB)
. The first player makes the initial move.
During a turn, a player selects one of four diagonal directions—northeast, northwest, southeast, or southwest—and moves their pawn any positive number of squares in that direction. The game concludes when a player's move results in both pawns occupying the same square, and that player is declared the winner.
Both players employ optimal strategies. If a player can secure a win, they will choose a strategy that minimizes the total number of moves. Conversely, if winning is not possible, they will aim to maximize the number of moves. Your task is to determine the game's outcome.
Input
The first line contains two integers N
and M
, separated by a space. The second line contains four integers RW
, CW
, RB
, CB
, also separated by spaces.
Output
If the first player wins, print "White X" (without quotes). If the second player wins, print "Black X" (without quotes). If neither player can win, print "Draw" (without quotes). Here, X
represents the total number of moves in the game.
Constraints:
2 ≤ N, M ≤ 1,000,000,000 (10^9)
1 ≤ RW, RB ≤ N
1 ≤ CW, CB ≤ M
The starting positions
(RW, CW)
and(RB, CB)
are distinct.
Notes
In the second example, the first player has two potential moves initially. Moving the white pawn to (2, 3)
results in a loss on the subsequent move, so the optimal strategy is to move to (2, 1)
. The second player then moves to (2, 3)
, followed by the first player moving back to (1, 2)
. The second player can then conclude the game on their next move.