P13771 [CodeChef] cw5
NOI
题目描述

With her new hair-style, Penny has to listen to all the comments of Sheldon Cooper. She (God knows why) challenged Sheldon Cooper for a match of Chess. Penny wants to defeat Dr. Sheldon Cooper in the game of chess. Although, she tried very hard, she is in a situation and wants your help. It is your duty to help Penny. The situation goes like this. Penny has only "King" left with her, while Sheldon has a King, a Queen, a Rook and a Bishop. You are given a situation of a chess board as input.
Sheldon has given Penny a CHECK, you need to tell Penny, whether this is the end of the game or she still has a chance. In case, she still has a choice, ensure she is safe in the next step too.
P.S. All rules of chess apply here. The death of a King is considered as end of the game. You can also refer to http://en.wikipedia.org/wiki/Chess for the rules.
Input
A description of the 8X8 chessboard grid is given. Empty boxes are shown as "_", Penny's King is shown by P, Sheldon's king is shown by S, and the queen, rook and bishop are shown by Q, R and B respectively.
Output
Print CHECKMATE! if its a checkmate, else print NOT YET!. Consider each and every possible ways, and remember ALL rules of Chess applies here.
Example
Input:
_B


__Q_____


_PS_
_R
____



Output:
NOT YET!
Input:



S
______B

Q__P
R
____



Output:
CHECKMATE!
Explanation
Example case 1. Penny can still move her King to either one step Up or one step to left. So, this isn't a checkmate.

输入格式

见题面

输出格式

见题面

样例输入
____B___ ________ __Q_____ ________ ____P_S_ _R______ ________ ________
样例输出
NOT YET!