Chess Battles
In chess, pieces move as follows (note that pawns are not included in this task):
The king can move to any adjacent square, whether vertically, horizontally, or diagonally.
The queen can move any number of squares vertically, horizontally, or diagonally.
The rook can move any number of squares vertically or horizontally.
The bishop can move any number of squares diagonally.
The knight moves in an "L" shape: either 1 square horizontally and 2 squares vertically, or 1 square vertically and 2 squares horizontally.
You are given the positions of one white piece and one black piece. Your task is to determine if the pieces can attack each other, and if so, specify which piece attacks the other.
Input
The first line of the input contains the type and position of the white piece. The second line contains the type and position of the black piece. Each piece is represented by a string of three characters. The first character indicates the type of piece: B for bishop, N for knight, R for rook, Q for queen, and K for king. The second character represents the file (from a to h), and the third character represents the rank (from 1 to 8). It is guaranteed that the pieces occupy different squares on the chessboard.
Output
Output a single word as the answer to the task.
If neither piece can attack the other, output NONE. If both pieces can attack each other, output BOTH. If only the white piece can attack the black piece, output WHITE. If only the black piece can attack the white piece, output BLACK.