#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
const ll MAXN = 1e6 + 6;
const ll inf = 1e17 + 7;
const ll mod = 998244353;
const ll prod = 53;
mt19937 rnd(2);

int main() {
    ll t;
    cin >> t;
    ll n, m, a;
    cin >> n >> m;
    ll cnt[2];
    cnt[0] = 0;
    cnt[1] = 0;
    vector<ll> arr;
    vector<ll> arr1;
    string s1;
    for (int i = 0; i < n; i++) {
        cin >> a;
        arr1.push_back(a);
        cnt[a % 2]++;
    }
    string s;
    cin >> s1;
    if (cnt[0] > 0 && cnt[1] > 0) {
        cout << "No" << "\n";
        return 0;
    }
    cout << "Yes" << "\n";
    if (t == 1) {
        return 0;
    }
    ll res = 1;
    for (int i = 0; i < (1 << 10); i++) {
        ll p = m;
        arr = arr1;
        int flag = 0;
        s = s1;
        for (int j = 0; j < 10; j++) {
            if (((1 << j) & i) > 0) {
                ll l = 0;
                for (int k = 0; k < n; k++) {
                    l = max(l, arr[k]);
                }
                if (l == p) {
                    flag = 1;
                } else {
                    p = l;
                }
            }
            if (flag == 1) {
                break;
            }
            for (int k = 0; k < n; k++) {
                if (arr[k] == p) {
                    s[k] = 'L';
                }
                if (arr[k] == 1) {
                    s[k] = 'R';
                }
                if (s[k] == 'L') {
                    arr[k]--;
                } else {
                    arr[k]++;
                }
            }
            bool f1 = false;
            for (int k = 0;k<n-1;k++) {
                if (arr[k] == arr[k+1] && s[k] == s[k+1]) {
                    continue;
                }
                f1 = true;
            }
            if (!f1) {
                if (p == 6) {
                    ll fd = 0;
                }
                res = max(res,p);
                break;
            }
        }
    }
    cout << res << "\n";
}
