You are given pairs of chess pieces with locations; for each pair, you are to output true if the first piece can attack the second, and false otherwise.
A number , followed by pairs of pieces.
Each piece is specified in the following format: type . Type is a character: K for king, Q for queen, R for rook, B for bishop, and N for knight. and are ints such that and ; they specify the and coordinates of the piece’s position on the chessboard.
In each pair, the two pieces are guaranteed to be in different positions.
For each pair, output true if the first piece can attack the second, and false otherwise. Refer to Wikipedia (or another internet source) for information on how each of the pieces behave.
Input
4 Q 2 3 Q 3 5 Q 2 3 Q 4 5 B 1 1 K 2 3 N 1 1 K 2 3
Output
false true false true