#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update<>>

const int MOD = 998244353;
const int INF = 1e18;


int ans = 0;

void rec(int n, int m, vector<int> a, string s, int t) {
    set<int> st;
    set<char> st2;
    for (auto it: a) {
        st.insert(it);
    }
    for (auto it: s) {
        st2.insert(it);
    }
    if (st.size() == 1 && st2.size() == 1) {
        ans = max(ans, m);
        return;
    }
    int mx = 0;
    for (auto it: a) {
        mx = max(mx, it);
    }
    for (int sz = mx; sz <= m - 1; sz++) {
        vector<int> na = a;
        string ns = s;
        for (int i = 0; i < n; i++) {
            if (na[i] == sz) {
                ns[i] = 'L';
            }
        }
        for (int i = 0; i < n; i++) {
            if (ns[i] == 'R') {
                na[i]++;
            } else {
                na[i]--;
            }
            if (na[i] == 0) {
                ns[i] = 'R';
            }
            if (na[i] == sz) {
                ns[i] = 'L';
            }
        }
        rec(n, sz, na, ns, t + 1);
    }
}

void solve() {
    int t, n, m;
    cin >> t >> n >> m;

    vector<int> a(n, 0);

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }

    string s;
    cin >> s;

    vector<int> cnt(2, 0);

    for (int i = 0; i < n; i++) {
        int curr = a[i];
        if (s[i] == 'L') {
            curr = 2 * m - a[i];
        }
        cnt[curr % 2]++;
    }

    if (cnt[0] && cnt[1]) {
        cout << "No" << endl;
        return;
    }

    cout << "Yes" << endl;

    if (t < 2) {
        return;
    }

    rec(n, m, a, s, 0);

    cout << ans + 1 << endl;
}


signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;

    while (t--) {
        solve();
    }
}
