#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>

using namespace std;
using ll = long long;
using ld = long double;

#define int ll

map<char, char>  o = {{'L', 'R'}, {'R', 'L'}};

int n;
int res = -1;
void pere(vector<int> a, string s, int m, int t) {
    if (t >= 200) return;
    bool flag = true;
    for (int i = 1; i < n; ++i) 
        if (a[i] != a[0] || s[i] != s[0]) {
            flag = false;
            break;
        }
    if (flag || m == 1) {
        res = max(res, m);
        return;
    }

    int maxx = *max_element(a.begin(), a.end());
    for (int c = maxx + 1; c < m; ++c) {
        auto sx = s;
        for (int i = 0; i < n; ++i)
            if (a[i] == c - 1 && sx[i] == 'R')
                sx[i] = 'L';

        pere(a, sx, c, 0);
    }

    for (int i = 0; i < n; ++i) {
        if (s[i] == 'L')
            a[i]--;
        else
            a[i]++;
    }

    for (int i = 0; i < n; ++i)
        if (a[i] == m - 1 && s[i] == 'R' || a[i] == 0 && s[i] == 'L')
            s[i] = o[s[i]];
    pere(a, s, m, t + 1);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;

    int 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());
    for (int i = 0; i < n; ++i) {
        if ((a[i] - a[0]) % 2 == 1) {
            cout << "No";
            return 0;
        }
    }


    string s;
    cin >> s;

    cout << "Yes\n";
    if (t == 1) return 0;
    
    pere(a, s, m, 0);
    cout << res << '\n';
    if (t == 2) return 0;


}