Chess Battles#5152

Chess Battles

1 second
64 megabytes
Easy

In chess, pieces move as follows (note that pawns are not included in this task):

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 to ), and the third character represents the rank (from to ). 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.

Examples

Example 1

Loading
Loading