Hint
<center>
</center>
Now we introduce some basic rules of Xiangqi. Xiangqi is played on a
10×9 board and the pieces are placed on the intersections (points). The
top left point is (1,1) and the bottom right point is (10,9). There are
two groups of pieces marked by black or red Chinese characters,
belonging to the two players separately. During the game, each player in
turn moves one piece from the point it occupies to another point. No two
pieces can occupy the same point at the same time. A piece can be moved
onto a point occupied by an enemy piece, in which case the enemy piece
is "captured" and removed from the board. When the general is
in danger of being captured by the enemy player on the enemy player’s
next move, the enemy player is said to have "delivered a
check". If the general's player can make no move to prevent the
general's capture by next enemy move, the situation is called
“checkmate”.
We only use 4 kinds of pieces introducing as follows:
<center>
</center>
<center>Hobbling the horse’s leg</center>
Now you are given a situation only containing a black general, a red
general and several red chariots, cannons and horses, and the red side
has delivered a check. Now it turns to black side’s move. Your job is to
determine that whether this situation is “checkmate”.输入描述
The input contains no more than 40 test cases. For each test case, the
first line contains three integers representing the number of red pieces
N (2<=N<=7) and the position of the black general. The following n
lines contain details of N red pieces. For each line, there are a char
and two integers representing the type and position of the piece (type
char ‘G’ for general, ‘R’ for chariot, ‘H’ for horse and ‘C’ for
cannon). We guarantee that the situation is legal and the red side has
delivered the check.
There is a blank line between two test cases. The input ends by 0 0 0.
输出描述
For each test case, if the situation is checkmate, output a single word
‘YES’, otherwise output the word ‘NO’.输入例子
2 1 4
G 10 5
R 6 4
3 1 5
H 4 5
G 10 5
C 7 5
0 0 0
输出例子
YES
NO
<center></center>
<center>Situation 1</center>
<center></center>
<center>Situation 2</center>