#include<iostream>#include<vector>#include<stack>#include<list>#include<map>#include<set>#include<deque>#include<queue>#include<cstring>#include<unordered_map>#include<unordered_set>#include<algorithm>#include<numeric>#include<chrono>#include<ctime>#include<cmath>#include<cctype>#include<string>#include<cstdio>#include<iomanip>#include<thread>#include<mutex>#include<condition_variable>#include<functional>#include<iterator>usingnamespace std;constint ROW =11, COL =10;constint dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};int matrix[ROW][COL]={0}, kill[ROW][COL]={0};//当前下标是否合法 x -- 1 - 10 y -- 1 - 9boolIsLegal(int x,int y){if(x <=0|| y <=0|| x >= ROW || y >= COL)returnfalse;returntrue;}//找下一个自己这方的intGetLeftRight(int x,int y ,int nAdd){
y += nAdd;while(y >=1&& y <= COL -1&& matrix[x][y]==0) y += nAdd;return y;}//找下一个自己这方的intGetUpDown(int x,int y,int nAdd){
x += nAdd;while(x >=1&& x <= ROW -1&& matrix[x][y]==0) x += nAdd;return x;}//增加从x , y 开始能被杀死的次数voidkillLine(int x,int y,int c,int flag){//上 if(flag ==0){
c =max(1, c); x =min(x, COL -1);for(int i = c; i <= x;++i) kill[i][y]++;}//下elseif(flag ==1){
x =max(1, x); c =min(c, COL -1);for(int i = x; i <= c;++i) kill[i][y]++;}//左elseif(flag ==2){
c =max(1, c); y =min(y, ROW -1);for(int i = c; i <= y;++i) kill[x][i]++;}//右elseif(flag ==3){
y =max(1, y); c =min(c, ROW -1);for(int i = y; i <= c;++i) kill[x][i]++;}}voidKillOne(int x,int y){switch(matrix[x][y]){//帅case'G':{//向上一个开始 一直到下个自己人 或者越界killLine(x-1, y,GetUpDown(x, y,-1),0);break;}//车case'R':{//四周扩散killLine(x-1, y,GetUpDown(x, y,-1),0);killLine(x+1, y,GetUpDown(x, y,1),1);killLine(x, y -1,GetLeftRight(x, y,-1),2);killLine(x, y+1,GetLeftRight(x, y,1),3);break;}//马case'H':{int up = x +1,down = x -1,left = y -1,right = y+1;//能上下左右跳 到达位置杀死次数+1if(matrix[up][y]==0){int t1 = x +2, t2 = y -1;if(IsLegal(t1, t2)) kill[t1][t2]++;
t2 = y +1;if(IsLegal(t1, t2)) kill[t1][t2]++;}if(matrix[down][y]==0){int t1 = x -2,t2 = y -1;if(IsLegal(t1, t2)) kill[t1][t2]++;
t2 = y +1;if(IsLegal(t1, t2)) kill[t1][t2]++;}if(matrix[x][left]==0){int t1 = x -1, t2 = y -2;if(IsLegal(t1, t2)) kill[t1][t2]++;
t1 = x +1;if(IsLegal(t1, t2)) kill[t1][t2]++;}if(matrix[x][right]==0){int t1 = x -1, t2 = y +2;if(IsLegal(t1, t2)) kill[t1][t2]++;
t1 = x +1;if(IsLegal(t1, t2)) kill[t1][t2]++;}break;}//炮case'C':{//隔山打牛 先找山 在找牛 然后打死他int up =GetUpDown(x, y,-1);killLine(up -1, y,GetUpDown(up,y,-1),0);int down =GetUpDown(x, y,1);killLine(down +1, y,GetUpDown(down, y,1),1);int left =GetLeftRight(x, y,-1);killLine(x, left -1,GetLeftRight(x, left,-1),2);int right =GetLeftRight(x, y,1);killLine(x, right +1,GetLeftRight(x, right,1),3);break;}default:break;}}intmain(){char ch;int n, x, y,a,b;while(cin >> n >> x >> y && n){memset(matrix,0,sizeof(matrix));memset(kill,0,sizeof(kill));for(int i =0; i < n;++i){
cin >> ch >> a >> b;
matrix[a][b]= ch;}for(int i =1; i < ROW;++i){for(int j =1; j < COL;++j){if(!matrix[i][j])continue;KillOne(i, j);}}bool ret =false;for(int i =0; i <4;++i){int nx = x + dir[i][0];int ny = y + dir[i][1];//将能走到的情况下 判断这个位置 是否在 谁的攻击方位 (自己是不能杀自己的) 只要不在别人攻击范围 将就能干掉别人 也就将不死他if(nx >0&& nx <=3&& ny >3&& ny <=6){if(kill[nx][ny]==0){
ret =true;break;}}}if(ret) cout <<"NO"<< endl;else cout <<"YES"<< endl;}return0;}