#include <bits/stdc++.h>

using namespace std;

int mx = -1;

vector<string> move(vector<string> x, int n, int m) {
    vector<string> x2(n,string(m, '*'));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < m; ++j) {
            if(x[i][j] == 'L') {
                if(j == 0) {
                    x[i][j] = 'R';
                }
            } else if(x[i][j] == 'R') {
                if(j == m-1) {
                    x[i][j] = 'L';
                }
            }
            if(x[i][j] == 'L') {
                x2[i][j-1] = 'L';
            } else if(x[i][j] == 'R') {
                x2[i][j+1] = 'R';
            }
        }
    }
    return x2;
}

map<vector<string>,int> mp;

void rec(vector<string> x, int n, int m, int d) {
    if(mp[x]) {
        return;
    }
    mp[x] = 1;
    for(int i = 0; i < m; ++i) {
        bool ans = true;        
        for(int j = 1; j < n; ++j) {
            ans &= (x[j][i] == x[j-1][i]);
        }
        ans &= (x[0][i] == 'L' || x[0][i] == 'R');
        if(ans) {
            mx = max(mx, m);     
            return;       
        }
    }
    for(int i = 0; i < m; ++i) {
        bool ok = true;
        for(int j = 0; j < n; ++j) {
            ok &= x[j][m - i - 1] == '*';
        }
        if(!ok) {
            break;
        }
        vector<string> x2 = move(x, n, m - i - 1);
        rec(x2, n, m - i-1, d + 1);
    }
    vector<string> x2 = move(x, n, m);
    rec(x2, n, m, d + 1);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i]--;
    }
    sort(a.begin(),a.end());
    string s;
    cin >> s;
    bool ok = true;
    for(int i = 1; i < n; ++i) {
        ok&=((a[i] - a[i-1]) % 2 == 0);
    }
    cout << (ok ? "Yes\n" : "No\n");
    return 0;
}