#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,bmi2")
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
int rec(int n, int m, vector<int>poses, vector<char>dirs) {
    if (m == 1) {
        return m;
    }
    set<pair<int, char> >oe;
    for (int i = 1; i <= n; i++) {
        if (poses[i - 1] == m) {
            dirs[i - 1] = 'L';
        }
        if (poses[i - 1] == 1) {
            dirs[i - 1] = 'R';
        }
        oe.insert({poses[i - 1], dirs[i - 1]});
    }
    if (oe.size() == 1) {
        return m;
    }
    // cout << "? " << n << ' ' << m << endl;
    int ans = 0;
    for (int t = 0; t <= m * 2; t++) {
        int mx = 0;
        for (int i = 1; i <= n; i++) {
            mx = max(mx, poses[i - 1]);
        }
        for (int j = mx; j < m; j++) {
            ans = max(ans, rec(n, j, poses, dirs));
        }
        for (int i = 1; i <= n; i++) {
            if (poses[i - 1] == m) {
                dirs[i - 1] = 'L';
            }
            if (poses[i - 1] == 1) {
                dirs[i - 1] = 'R';
            }
            if (dirs[i - 1] == 'L') {
                poses[i - 1]--;
            } else {
                poses[i - 1]++;
            }
        }
    }
    return ans;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    int n;
    cin >> n;
    int m;
    cin >> m;
    int a[n + 1];
    set<int>s;
    vector<int>poses;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        s.insert(a[i] % 2);
        poses.push_back(a[i]);
    }
    if (s.size() > 1) {
        cout << "No";
        exit(0);
    }
    cout << "Yes\n";
    if (t == 1) {
        exit(0);
    }
    char c[n + 1];
    vector<char>dirs;
    for (int j = 1; j <= n; j++) {
        cin >> c[j];
        dirs.push_back(c[j]);
    }
    cout << rec(n, m, poses, dirs);
}