#include <bits/stdc++.h>
 
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(a) (int)(a.size())
 
#ifdef LOCAL
#define __lg(x) log2(x)
#endif
 
using ld = long double;
using ll = long long;
 
using namespace std;
 
void solve() {
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    string s;
    cin >> s;
 
    vector<int> mv(n);
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'L') mv[i] = -1;
        else mv[i] = 1;
    }
 
    for (int i = 0; i < n; ++i) {
        if (a[i] % 2 != a[0] % 2) {
            cout << "NO\n";
            return;
        }
    }
    cout << "YES\n";
 
}
 
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int t = 1;
    // cin >> t;
    while (t--) solve();
}
