#include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:102400000,102400000 )   const int maxn = 5e5 + 5;   struct Point {     char ty;     int x, y;     Point(char ch =  0 , int x = 0, int y = 0) : ty(ch), x(x), y(y) {}   } chess[maxn];   int X0, Y0, n;   bool solve1() {     vector<pair<int, char> > v;     for (int i = 1; i <= n; i++) {       if (chess[i].x == X0) v.push_back(make_pair(chess[i].y, chess[i].ty));     }     if (v.size() == 0) return false;     sort(v.begin(), v.end());     for (int i = 0; i < v.size() - 1; i++) {       if (v[i].first < Y0 && v[i + 1].first > Y0) {         if (v[i].second ==  R  || v[i].second ==  Q  || v[i + 1].second ==  R  ||             v[i + 1].second ==  Q )           return true;         return false;       }     }     int len = v.size();     if (v[len - 1].first < Y0 &&         (v[len - 1].second ==  R  || v[len - 1].second ==  Q ))       return true;     if (v[0].first > Y0 && (v[0].second ==  R  || v[0].second ==  Q ))       return true;     return false;   }   bool solve2() {     vector<pair<int, char> > v;     for (int i = 1; i <= n; i++) {       if (chess[i].y == Y0) v.push_back(make_pair(chess[i].x, chess[i].ty));     }     if (v.size() == 0) return false;     sort(v.begin(), v.end());     for (int i = 0; i < v.size() - 1; i++) {       if (v[i].first < X0 && v[i + 1].first > X0) {         if (v[i].second ==  R  || v[i].second ==  Q  || v[i + 1].second ==  R  ||             v[i + 1].second ==  Q )           return true;         return false;       }     }     int len = v.size();     if (v[len - 1].first < X0 &&         (v[len - 1].second ==  R  || v[len - 1].second ==  Q ))       return true;     if (v[0].first > X0 && (v[0].second ==  R  || v[0].second ==  Q ))       return true;     return false;   }   bool solve3() {     vector<pair<int, char> > v;     for (int i = 1; i <= n; i++) {       if (chess[i].x == chess[i].y)         v.push_back(make_pair(chess[i].x, chess[i].ty));     }     if (v.size() == 0) return false;     sort(v.begin(), v.end());     for (int i = 0; i < v.size() - 1; i++) {       if (v[i].first < X0 && v[i + 1].first > X0) {         if (v[i].second ==  B  || v[i].second ==  Q  || v[i + 1].second ==  B  ||             v[i + 1].second ==  Q )           return true;         return false;       }     }     int len = v.size();     if (v[len - 1].first < X0 &&         (v[len - 1].second ==  B  || v[len - 1].second ==  Q ))       return true;     if (v[0].first > X0 && (v[0].second ==  B  || v[0].second ==  Q ))       return true;     return false;   }   bool solve4() {     vector<pair<int, char> > v;     for (int i = 1; i <= n; i++) {       if (chess[i].x == -chess[i].y)         v.push_back(make_pair(chess[i].x, chess[i].ty));     }     if (v.size() == 0) return false;     sort(v.begin(), v.end());     for (int i = 0; i < v.size() - 1; i++) {       if (v[i].first < X0 && v[i + 1].first > X0) {         if (v[i].second ==  B  || v[i].second ==  Q  || v[i + 1].second ==  B  ||             v[i + 1].second ==  Q )           return true;         return false;       }     }     int len = v.size();     if (v[len - 1].first < X0 &&         (v[len - 1].second ==  B  || v[len - 1].second ==  Q ))       return true;     if (v[0].first > X0 && (v[0].second ==  B  || v[0].second ==  Q ))       return true;     return false;   }   int main() {     cin >> n >> X0 >> Y0;     for (int i = 1; i <= n; i++) {       char ch;       int a, b;       scanf( %s%d%d , &ch, &a, &b);       chess[i] = Point(ch, a - X0, b - Y0);     }     X0 = Y0 = 0;     if (solve1() || solve2() || solve3() || solve4())       printf( YES n );     else       puts( NO );     return 0;   }