The King's Race
Contest: Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2)
Difficulty rating: 800
Tags: implementation, math

On a chessboard with a width of $$$n$$$ and a height of $$$n$$$, rows are numbered from bottom to top from $$$1$$$ to $$$n$$$, columns are numbered from left to right from $$$1$$$ to $$$n$$$. Therefore, for each cell of the chessboard, you can assign the coordinates $$$(r,c)$$$, where $$$r$$$ is the number of the row, and $$$c$$$ is the number of the column.

The white king has been sitting in a cell with $$$(1,1)$$$ coordinates for a thousand years, while the black king has been sitting in a cell with $$$(n,n)$$$ coordinates. They would have sat like that further, but suddenly a beautiful coin fell on the cell with coordinates $$$(x,y)$$$...

Each of the monarchs wanted to get it, so they decided to arrange a race according to slightly changed chess rules:

As in chess, the white king makes the first move, the black king makes the second one, the white king makes the third one, and so on. However, in this problem, kings can stand in adjacent cells or even in the same cell at the same time.

The player who reaches the coin first will win, that is to say, the player who reaches the cell with the coordinates $$$(x,y)$$$ first will win.

Let's recall that the king is such a chess piece that can move one cell in all directions, that is, if the king is in the $$$(a,b)$$$ cell, then in one move he can move from $$$(a,b)$$$ to the cells $$$(a + 1,b)$$$, $$$(a - 1,b)$$$, $$$(a,b + 1)$$$, $$$(a,b - 1)$$$, $$$(a + 1,b - 1)$$$, $$$(a + 1,b + 1)$$$, $$$(a - 1,b - 1)$$$, or $$$(a - 1,b + 1)$$$. Going outside of the field is prohibited.

Determine the color of the king, who will reach the cell with the coordinates $$$(x,y)$$$ first, if the white king moves first.

Input format:
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^{18}$$$) — the length of the side of the chess field.

The second line contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x,y \le n$$$) — coordinates of the cell, where the coin fell.

Output format:
In a single line print the answer "White" (without quotes), if the white king will win, or "Black" (without quotes), if the black king will win.

You can print each letter in any case (upper or lower).

Constraints:
Time limit: 1.0 s
Memory limit: 256.0 MB

Note:
An example of the race from the first sample where both the white king and the black king move optimally:

1. The white king moves from the cell $$$(1,1)$$$ into the cell $$$(2,2)$$$.
2. The black king moves form the cell $$$(4,4)$$$ into the cell $$$(3,3)$$$.
3. The white king moves from the cell $$$(2,2)$$$ into the cell $$$(2,3)$$$. This is cell containing the coin, so the white king wins.

An example of the race from the second sample where both the white king and the black king move optimally:

1. The white king moves from the cell $$$(1,1)$$$ into the cell $$$(2,2)$$$.
2. The black king moves form the cell $$$(5,5)$$$ into the cell $$$(4,4)$$$.
3. The white king moves from the cell $$$(2,2)$$$ into the cell $$$(3,3)$$$.
4. The black king moves from the cell $$$(4,4)$$$ into the cell $$$(3,5)$$$. This is the cell, where the coin fell, so the black king wins.

In the third example, the coin fell in the starting cell of the black king, so the black king immediately wins.

Example input:
4
2 3

Example output:
White

Example input:
5
3 5

Example output:
Black

Editorial:
Let's find the minimum time needed for the white king to reach the coin.
It is obvious that it is always optimal to move only towards the coin. In case of white king it means that we should move only up, right or up-right diagonally. During one move we can only add $$$1$$$ or $$$0$$$ to any of our coordinates (or to both of them), it means that the length of the optimal path can not be smaller than $$$max(x-1,y-1)$$$.
Let's show that we can reach the coin with $$$max(x-1,y-1)$$$ moves.
First step. Let $$$z$$$ be equal to $$$min(x,y)$$$. The king does $$$z-1$$$ up-right moves, so after that the king will be in the cell $$$(z,z)$$$.
Second step. Let's assume that $$$x \le y$$$ (the case when $$$x > y$$$ is proved in a similar way). So $$$z = x$$$. It means that the king is in the cell $$$(x,x)$$$. Now the king can do $$$y-x$$$ up moves, after which he would be in the cell $$$(x,y)$$$.
It took him $$$(x-1)+(y-x)=y-1$$$ moves to reach the coin. If $$$x$$$ was greater than $$$y$$$ he would need $$$x-1$$$ moves (could be proved the same way).
So now we proved that it takes $$$max(x-1,y-1)$$$ moves for the white king to reach the coin.
In the same way we can prove that it takes $$$max(n-x,n-y)$$$ steps for the black king to reach the coin.
The king, which is closer to the coin, wins. If the distances is equal, than the white king wins, because he moves first.
Final description of the algorithm:
If $$$max(n-x,n-y)<max(x-1,y-1)$$$ then the answer is "Black", otherwise the answer is "White".
It is also can be proven that instead of comparing minimal distances between the coin and the kings we can compare manhattan distances between them. I will leave the proof as homework task.