#include <bits/stdc++.h>
using namespace std;
const long long int Maxn3 = 1e3 + 10;
const long long int Maxn4 = 1e4 + 10;
const long long int Maxn5 = 1e5 + 10;
const long long int Maxn6 = 1e6 + 10;
const long long int Maxn7 = 1e7 + 10;
const long long int Maxn8 = 1e8 + 10;
const long long int Maxn9 = 1e9 + 10;
const long long int Maxn18 = 1e18 + 10;
const long long int Mod1 = 1e7 + 7;
const long long int Mod2 = 1e9 + 7;
const long long int LLMax = LLONG_MAX;
const long long int LLMin = LLONG_MIN;
const long long int INTMax = INT_MAX;
const long long int INTMin = INT_MIN;
long long int mn = LLMax, mx = LLMin;
char s[5][5];
long long int d[5][5];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  for (long long int i = 0; i < 3; i++)
    for (long long int j = 0; j < 3; j++) s[i][j] = '.', d[i][j] = mn;
  long long int n, X, Y;
  cin >> n >> X >> Y;
  while (n--) {
    char c;
    long long int x, y;
    cin >> c >> x >> y;
    x -= X;
    y -= Y;
    if (x != 0 and y != 0 and abs(x) != abs(y)) continue;
    long long int l = max(abs(x), abs(y));
    if (x != 0) x /= abs(x);
    if (y != 0) y /= abs(y);
    x++;
    y++;
    if (l < d[x][y]) {
      d[x][y] = l;
      s[x][y] = c;
    }
  }
  for (long long int x = -1; x <= 1; x++)
    for (long long int y = -1; y <= 1; y++) {
      if (s[x + 1][y + 1] == '.') continue;
      if (s[x + 1][y + 1] == 'Q') return cout << "YES", 0;
      if ((s[x + 1][y + 1] == 'R') ^ (x != 0 && y != 0))
        return cout << "YES", 0;
    }
  return cout << "NO", 0;
}
