#include <bits/stdc++.h>   using namespace std;   int binary_search(vector<int> a, int korol) {     if (a[a.size() - 1] < korol) return a.size() - 1;     if (a[0] > korol) return -1;     int max = a.size() - 1, min = 0, mid;     if (min + max >= 0)       mid = (int)((min + max) / 2);     else       mid = (int)((min + max - 1) / 2);     while (1) {       while (a[mid] > korol) {         max = mid;         if (min + max >= 0)           mid = (int)((min + max) / 2);         else           mid = (int)((min + max - 1) / 2);       }       while (a[mid] < korol && mid != min) {         min = mid;         if (min + max >= 0)           mid = (int)((min + max) / 2);         else           mid = (int)((min + max - 1) / 2);       }       if (min == mid) return min;     }   }   int result(vector<int> a, vector<int> b, int korol) {     sort(a.begin(), a.begin() + a.size());     sort(b.begin(), b.begin() + b.size());     int min_a = binary_search(a, korol);     int min_b = binary_search(b, korol);     if (min_a != -1 && min_b == -1) {       cout <<  YES ;       return 1;     }     if (min_b != -1 && min_a != -1 && a[min_a] > b[min_b]) {       cout <<  YES ;       return 1;     }     if (min_a + 1 != a.size() && min_b + 1 == b.size()) {       cout <<  YES ;       return 1;     }     if (min_a + 1 != a.size() && min_b + 1 != b.size() &&         a[min_a + 1] < b[min_b + 1]) {       cout <<  YES ;       return 1;     }     return 0;   }   int main() {     int n;     cin >> n;     int korol_x, korol_y;     cin >> korol_x >> korol_y;     vector<int> slon_na_glav(0);     vector<int> slon_na_dobav(0);     vector<int> pomecha_gor(0);     vector<int> pomecha_ver(0);     vector<int> ladia_na_gor(0);     vector<int> ladia_na_ver(0);     vector<int> pomecha_glav(0);     vector<int> pomecha_dobav(0);     for (int i = 0; i < n; i++) {       char fig;       cin >> fig;       int x, y;       cin >> x >> y;       if (fig ==  B ) {         if (y - x == korol_y - korol_x) slon_na_glav.push_back(x);         if (y + x == korol_x + korol_y) slon_na_dobav.push_back(x);         if (x == korol_x) pomecha_ver.push_back(y);         if (y == korol_y) pomecha_gor.push_back(x);       }       if (fig ==  R ) {         if (y - x == korol_y - korol_x) pomecha_glav.push_back(x);         if (y + x == korol_x + korol_y) pomecha_dobav.push_back(x);         if (x == korol_x) ladia_na_ver.push_back(y);         if (y == korol_y) ladia_na_gor.push_back(x);       }       if (fig ==  Q ) {         if (y - x == korol_y - korol_x) slon_na_glav.push_back(x);         if (y + x == korol_x + korol_y) slon_na_dobav.push_back(x);         if (x == korol_x) ladia_na_ver.push_back(y);         if (y == korol_y) ladia_na_gor.push_back(x);       }     }     int progress = 0;     if (!slon_na_glav.empty()) {       if (pomecha_glav.empty()) {         cout <<  YES ;         return 0;       }       progress = result(slon_na_glav, pomecha_glav, korol_x);       if (progress) return 0;     }     if (!slon_na_dobav.empty()) {       if (pomecha_dobav.empty()) {         cout <<  YES ;         return 0;       }       progress = result(slon_na_dobav, pomecha_dobav, korol_x);       if (progress) return 0;     }     if (!ladia_na_gor.empty()) {       if (pomecha_gor.empty()) {         cout <<  YES ;         return 0;       }       progress = result(ladia_na_gor, pomecha_gor, korol_x);       if (progress) return 0;     }     if (!ladia_na_ver.empty()) {       if (pomecha_ver.empty()) {         cout <<  YES ;         return 0;       }       progress = result(ladia_na_ver, pomecha_ver, korol_y);       if (progress) return 0;     }     cout <<  NO ;     return 0;   }