#include <bits/stdc++.h>
using namespace std;
char piece;
long long x, y;
long long n, xwhite, ywhite;
char diagLUch, diagRUch, diagLDch, diagRDch, vertUch, vertDch, orizLch, orizRch;
long long diagLU, diagRU, diagLD, diagRD, vertU, vertD, orizL, orizR;
void updateDiagonal() {
  int line, col;
  line = xwhite - x;
  col = ywhite - y;
  if (line > 0) {
    if (col > 0) {
      if (diagLU > abs(xwhite - x)) {
        diagLU = abs(xwhite - x);
        diagLUch = piece;
      }
    } else {
      if (diagRU > abs(xwhite - x)) {
        diagRU = abs(xwhite - x);
        diagRUch = piece;
      }
    }
  } else {
    if (col > 0) {
      if (diagLD > abs(xwhite - x)) {
        diagLD = abs(xwhite - x);
        diagLDch = piece;
      }
    } else {
      if (diagRD > abs(xwhite - x)) {
        diagRD = abs(xwhite - x);
        diagRDch = piece;
      }
    }
  }
}
void updateLine() {
  if (y < ywhite) {
    if (orizL > ywhite - y) {
      orizL = ywhite - y;
      orizLch = piece;
    }
  } else {
    if (orizR > y - ywhite) {
      orizR = y - ywhite;
      orizRch = piece;
    }
  }
}
void updateColumn() {
  if (x < xwhite) {
    if (vertU > xwhite - x) {
      vertU = xwhite - x;
      vertUch = piece;
    }
  } else {
    if (vertD > x - xwhite) {
      vertD = x - xwhite;
      vertDch = piece;
    }
  }
}
int main() {
  diagLU = diagRU = diagLD = diagRD = vertU = vertD = orizL = orizR = 1e10;
  diagLUch = diagRUch = diagLDch = diagRDch = vertUch = vertDch = orizLch =
      orizRch = 'N';
  cin >> n;
  cin >> xwhite >> ywhite;
  for (long long i = 0; i < n; i++) {
    cin >> piece;
    cin >> x >> y;
    if (x == xwhite) {
      updateLine();
    }
    if (y == ywhite) {
      updateColumn();
    }
    if (abs(xwhite - x) == abs(ywhite - y)) {
      updateDiagonal();
    }
  }
  if (diagLDch == 'Q' || diagLDch == 'B' || diagLUch == 'Q' ||
      diagLUch == 'B' || diagRUch == 'Q' || diagRUch == 'B' ||
      diagRDch == 'Q' || diagRDch == 'B') {
    cout << "YES" << '\n';
    return 0;
  }
  if (vertDch == 'Q' || vertDch == 'R' || vertUch == 'Q' || vertUch == 'R' ||
      orizLch == 'Q' || orizLch == 'R' || orizRch == 'Q' || orizRch == 'R') {
    cout << "YES" << '\n';
    return 0;
  }
  cout << "NO" << '\n';
  return 0;
}
