#pragma warning(disable:4996)
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>
#include<time.h>
#include<map>
#include<set>
#include<sstream>
#include<cassert>
using namespace std;
const int INF = 0x3f3f3f3f;
int table[11][10];
int tabletemp[11][10];
int xt, yt;
int g(int xt, int yt, int check)
{
for (int j = xt - 1;j >= 1;j--)
{
if (table[j][yt] == -2)
{
check = 1;
break;
}
else if (table[j][yt] != 0)
break;
}
return check;
}
int r(int xt, int yt, int check)
{
for (int j = xt - 1;j >= 1;j--)
{
if (table[j][yt] == -2)
{
check = 1;
break;
}
else if (table[j][yt] != 0)
break;
}
for (int j = xt + 1;j <= 10;j++)
{
if (table[j][yt] == -2)
{
check = 1;
break;
}
else if (table[j][yt] != 0)
break;
}
for (int j = yt - 1;j >= 1;j--)
{
if (table[xt][j] == -2)
{
check = 1;
break;
}
else if (table[xt][j] != 0)
break;
}
for (int j = yt + 1;j <= 9;j++)
{
if (table[xt][j] == -2)
{
check = 1;
break;
}
else if (table[xt][j] != 0)
break;
}
return check;
}
int c(int xt, int yt, int check)
{
int sum = 0;
for (int j = xt + 1;j <= 10;j++)
{
if (table[j][yt] != 0 && table[j][yt] != -2)
{
sum++;
continue;
}
if (sum == 1 && table[j][yt] == -2)
{
check = 1;
break;
}
if (sum >= 2)
break;
}
for (int j = xt - 1;j >= 1;j--)
{
if (table[j][yt] != 0 && table[j][yt] != -2)
{
sum++;
continue;
}
if (sum == 1 && table[j][yt] == -2)
{
check = 1;
break;
}
if (sum >= 2)
break;
}
for (int j = yt - 1;j >= 1;j--)
{
if (table[xt][j] != 0 && table[xt][j] != -2)
{
sum++;
continue;
}
if (sum == 1 && table[xt][j] == -2)
{
check = 1;
break;
}
if (sum >= 2)
break;
}
for (int j = yt + 1;j <= 9;j++)
{
if (table[xt][j] != 0 && table[xt][j] != -2)
{
sum++;
continue;
}
if (sum == 1 && table[xt][j] == -2)
{
check = 1;
break;
}
if (sum >= 2)
break;
}
return check;
}
int h(int xt, int yt, int check)
{
if (table[xt - 1][yt] == 0)
{
if (table[xt - 2][yt - 1] == -2 || table[xt - 2][yt + 1] == -2)
check = 1;
}
if (table[xt + 1][yt] == 0)
{
if (table[xt + 2][yt - 1] == -2 || table[xt + 2][yt + 1] == -2)
check = 1;
}
if (table[xt][yt - 1] == 0)
{
if (table[xt - 1][yt - 2] == -2 || table[xt + 1][yt - 2] == -2)
check = 1;
}
if (table[xt][yt + 1] == 0)
{
if (table[xt - 1][yt + 2] == -2 || table[xt + 1][yt + 2] == -2)
check = 1;
}
return check;
}
int ck(int check)
{
for (int i = 1;i <= 10;i++)
{
for (int j = 1;j <= 9;j++)
{
switch (table[i][j])
{
case 1:
{
check = g(i, j, check);
break;
}
case 2:
{
check = r(i, j, check);
break;
}
case 3:
{
check = h(i, j, check);
break;
}
case 4:
{
check = c(i, j, check);
break;
}
default:break;
}
}
}
return check;
}
void cp(int table1[11][10], int table2[11][10])
{
for (int i = 1;i <= 10;i++)
{
for (int j = 1;j <= 9;j++)
{
table1[i][j] = table2[i][j];
}
}
}
int vs_main()
{
int n, x, y;
int check1, check2, check3, check4, check5;
while (cin >> n >> x >> y, n || x || y)
{
memset(table, 0, sizeof(table));
memset(tabletemp, 0, sizeof(tabletemp));
table[x][y] = -2;
int a, b;
for (int i = 0;i < n;i++)
{
char temp;
cin >> temp;
cin >> xt >> yt;
switch (temp)
{
case 'G':
{
a = xt;
b = yt;
table[xt][yt] = 1;break;
}
case 'R':
{
table[xt][yt] = 2;break;
}
case 'H':
{
table[xt][yt] = 3;break;
}
case 'C':
{
table[xt][yt] = 4;break;
}
default:break;
}
}
cp(tabletemp, table);
check1 = 0, check2 = 0, check3 = 0, check4 = 0;
if (x > 1)
{
table[x - 1][y] = -2;
table[x][y] = 0;
check1 = ck(check1);
cp(table, tabletemp);
}
else
{
check1 = 1;
}
if (x < 3)
{
table[x + 1][y] = -2;
table[x][y] = 0;
check2 = ck(check2);
cp(table, tabletemp);
}
else
{
check2 = 1;
}
if (y > 4)
{
table[x][y - 1] = -2;
table[x][y] = 0;
check3 = ck(check3);
cp(table, tabletemp);
}
else
{
check3 = 1;
}
if (y < 6)
{
table[x][y + 1] = -2;
table[x][y] = 0;
check4 = ck(check4);
cp(table, tabletemp);
}
else
{
check4 = 1;
}
if (check4 + check3 + check2 + check1 == 4)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
return 0;
}
int main()
{
int start = clock();
freopen("in.txt", "r", stdin);
//freopen("E:/out.txt","w",stdout);
printf("#===================#\n");
vs_main();
printf("#===================#\n");
printf("Time:%.3lf\n", double(clock() - start) / CLOCKS_PER_SEC);
//system("pause");
return 0;
}
2 1 4
G 10 5
R 6 4
3 1 5
H 4 5
G 10 5
C 7 5
2 1 5
R 4 4
G 10 5
3 1 5
G 10 4
R 5 5
H 3 7
4 1 5
G 10 4
C 6 5
H 5 5
R 1 1
5 1 5
G 10 4
C 6 5
H 5 5
H 4 5
R 1 1
3 1 5
G 10 4
C 2 7
H 3 7
3 1 5
G 10 4
R 5 5
R 1 6
4 1 5
G 10 4
R 5 5
R 1 6
H 3 7
3 1 5
G 10 5
R 2 4
R 2 6
4 2 6
R 1 7
R 3 7
H 4 4
G 10 5
0 0 0