//UVa1589 - Xiangqi
//WA
#include<iostream>
#include<string.h>
using namespace std;
typedef struct XYZ{
char name;
int x,y;
XYZ(int x = 0, int y = 0):x(x),y(y){};
};
int qp[11][10];//qipan
char sq[11][10];//shaqi
XYZ RQ[8];//red qi
void G(int x, int y);//jiang
void R(int x, int y);//che
void H(int x, int y);//ma
void C(int x, int y);//pao
int BGgoing(int x, int y);
int main(){
int RT;//red qi number
XYZ BG;//black G
while(cin>>RT>>BG.x>>BG.y){
//��ʼ��������
memset(qp,0,sizeof(qp));
memset(sq,'A',sizeof(sq));
//��¼����
for(int i = 1; i <= RT; i++){
cin>>RQ[i].name>>RQ[i].x>>RQ[i].y;
qp[RQ[i].x][RQ[i].y] = (int)RQ[i].name;
}
//doing
for(int i = 1; i <= RT; i++){
if(RQ[i].name == 'G') G(RQ[i].x,RQ[i].y);
if(RQ[i].name == 'R') R(RQ[i].x,RQ[i].y);
if(RQ[i].name == 'H') H(RQ[i].x,RQ[i].y);
if(RQ[i].name == 'C') C(RQ[i].x,RQ[i].y);
}
//ans out
if(BGgoing(BG.x, BG.y)) cout<<"YES
";
else cout<<"NO
";
//qp out
for(int i = 1; i <= 10; i++){
for(int j = 1; j <= 9; j++)
cout<<qp[i][j]<<" ";
cout<<"
";
}
continue;
}
return 0;
}
void G(int x, int y){
for(int i = 1; i <= 10; i++)
if(qp[i][y] != 0 && qp[i][y] != (int)'G')return ;
for(int i = 1; i <= 10; i++)
sq[i][y] = 'S';
}
void R(int x, int y){
for(int i = x-1; i >= 1; i--){
if(qp[i][y] == 0) sq[i][y] = 'S';
else break;
}
for(int i = x+1; i <= 10; i++){
if(qp[i][y] == 0) sq[i][y] = 'S';
else break;
}
for(int i = y-1; i >= 1; i--){
if(qp[x][i] == 0) sq[x][i] = 'S';
else break;
}
for(int i = y+1; i <= 9; i++){
if(qp[x][i] == 0) sq[x][i] = 'S';
else break;
}
return ;
}
void H(int x, int y){
if(qp[x-1][y] == 0) sq[x-2][y+1] = 'S', sq[x-2][y-1] = 'S';
if(qp[x+1][y] == 0) sq[x+2][y+1] = 'S', sq[x+2][y-1] = 'S';
if(qp[x][y-1] == 0) sq[x+1][y-2] = 'S', sq[x-1][y-2] = 'S';
if(qp[x][y+1] == 0) sq[x+1][y+2] = 'S', sq[x-1][y+2] = 'S';
return ;
}
void C(int x, int y){
int is = 0;
for(int i = x-1; i >= 1; i--){
if(qp[i][y] != 0) {is++; continue;}
if(is == 1) sq[i][y] = 'S';
else if(is == 2){ sq[i][y] = 'S'; break;}
}
is = 0;
for(int i = x+1; i <= 10; i++){
if(qp[i][y] != 0) {is++; continue;}
if(is == 1) sq[i][y] = 'S';
else if(is == 2){ sq[i][y] = 'S'; break;}
}
is = 0;
for(int i = y-1; i >= 1; i--){
if(qp[x][i] != 0) {is++; continue;}
if(is == 1) sq[x][i] = 'S';
else if(is == 2){ sq[x][i] = 'S'; break;}
}
is = 0;
for(int i = y+1; i <= 9; i++){
if(qp[x][i] != 0) {is++; continue;}
if(is == 1) sq[x][i] = 'S';
else if(is == 2){ sq[x][i] = 'S'; break;}
}
return ;
}
int BGgoing(int x, int y){
int iss = 0;
if(x-1>=1 && x-1<=3 && sq[x-1][y]=='S') iss++;
if(x+1>=1 && x+1<=3 && sq[x+1][y]=='S') iss++;
if(y-1>=4 && y-1<=6 && sq[x][y-1]=='S') iss++;
if(y+1>=4 && y+1<=6 && sq[x][y+1]=='S') iss++;
if(iss) return 1;
else return 0;
}