#include using namespace std; const int N = 400010; char s[N]; int main() { int n, m; scanf("%d%d", &n, &m); scanf("%s", s); deque a; int all = n + n + m + m; for (int i = 0; i < all; i++) { if (s[i] == 'A') a.push_back(i); } bool ok = true; for (int i = 0; i < all; i++) { char ch = s[i]; if (ch == 'A') continue; int left = i, right = i; if (ch == 'C') { left = a.front(); a.pop_front(); } else { right = a.back(); a.pop_back(); } if (left >= right) { ok = false; break; } } if (ok) printf("Yes\n"); else printf("No\n"); return 0; }