#include <bits/stdc++.h>
using namespace std;
int n;
int kx, ky;
struct Piece {
  bool d, h, k;
  int x, y;
  int sd;
  int md;
  bool operator==(const Piece& rhs) const {
    return (x == rhs.x) && (y == rhs.y);
  }
} k, p[500000];
void Read(Piece& q, bool type = false) {
  char ty;
  if (!type)
    scanf("\n%c", &ty);
  else
    ty = 'K';
  scanf("%d %d", &q.x, &q.y);
  q.md = q.x - q.y;
  q.sd = q.x + q.y;
  if (ty == 'Q')
    q.d = q.h = true;
  else if (ty == 'R')
    q.h = true, q.d = false;
  else if (ty == 'K')
    q.k = true;
  else if (ty == 'B')
    q.h = false, q.d = true;
  else
    q.h = q.d = false;
}
vector<Piece> v, h, md, sd;
bool compareX(const Piece& l, const Piece& r) { return l.x < r.x; }
bool compareY(const Piece& l, const Piece& r) { return l.y < r.y; }
int main() {
  scanf("%d", &n);
  Read(k, true);
  v.push_back(k), h.push_back(k), md.push_back(k), sd.push_back(k);
  for (int i = 0; i < n; i++) {
    Read(p[i]);
    if (p[i].y == k.y) h.push_back(p[i]);
    if (p[i].x == k.x) v.push_back(p[i]);
    if (p[i].md == k.md) md.push_back(p[i]);
    if (p[i].sd == k.sd) sd.push_back(p[i]);
  }
  sort(h.begin(), h.end(), compareX);
  sort(v.begin(), v.end(), compareY);
  sort(md.begin(), md.end(), compareX);
  sort(sd.begin(), sd.end(), compareX);
  bool check = false;
  for (size_t i = 0; i < h.size(); i++) {
    if (h[i].k) {
      if (i > 0) {
        if (h[i - 1].h) check = true;
      }
      if (i + 1 < h.size()) {
        if (h[i + 1].h) check = true;
      }
      break;
    }
  }
  for (size_t i = 0; i < v.size(); i++) {
    if (v[i].k) {
      if (i > 0) {
        if (v[i - 1].h) check = true;
      }
      if (i + 1 < v.size()) {
        if (v[i + 1].h) check = true;
      }
      break;
    }
  }
  for (size_t i = 0; i < md.size(); i++) {
    if (md[i].k) {
      if (i > 0 && md[i - 1].d) check = true;
      if (i + 1 < md.size() && md[i + 1].d) check = true;
      break;
    }
  }
  for (size_t i = 0; i < sd.size(); i++) {
    if (sd[i].k) {
      if (i > 0 && sd[i - 1].d) check = true;
      if (i + 1 < sd.size() && sd[i + 1].d) check = true;
      break;
    }
  }
  if (check)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
