eolymp
bolt
Try our new interface for solving problems
Problems

Who has won?

Who has won?

\includegraphics{https://static.e-olymp.com/content/4c/4cc5a45c3be4b2a14578f83d5a6da87eb34bf564.jpg} Your friend wants to make his girlfriend a special gift. She loves chess, so your friend decided to write this wonderful game for her beautiful pink touch mobile. But it was quite time-consuming task, and in time to time, he asks you to help him with the final stage of the game. You need just to tell, using the finally completed chess game, who has won. \InputFile The first line contains the number of test cases (\textbf{1} ≤ \textbf{t} ≤ \textbf{10}). Each test case consists of two lines. Its first line contains the number of white figures (\textbf{1} ≤ \textbf{n} ≤ \textbf{16}), followed by a single space determines their position on the board, as shown in the example. The second line of each test case in the same format describes the black pieces. Marking: \textbf{K} -- King, \textbf{Q} -- Queen, \textbf{R} -- Rook, \textbf{B} -- Bishop, \textbf{N} -- Knight, \textbf{P} - Pawn. White figures always are placed from the bottom (on the horizontal lines \textbf{1} and \textbf{2}). It is guaranteed that the input data is correct and that is really could have place in our life. (The game is finished if one of the kings checkmated or a stalemate is declared.) \OutputFile For each test case in a separate line, if white won - write "\textbf{WHITE}", if black won - write "\textbf{BLACK}", and if draw is, write "\textbf{DRAW}". Write words without quotes!
Time limit 1 second
Memory limit 64 MiB
Input example #1
1
2 Kc6 Ra8
1 Kc8
Output example #1
WHITE