#include <iostream>
#include <fstream>
#include <iomanip>
#include <random>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <bitset>
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
//#define int long long

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

int T, n, m;
vector<int> a;
string d;
int ans = 0;

void f() {
    if (m == 1) {
        ans = max(ans, 1);
        return;
    }
    for (int j = 0; j < n; j++) {
        if (a[j] == 1) d[j] = 'R';
        if (a[j] == m) d[j] = 'L';
    }
    bool flag = true;
    for (int i = 1; i < n; i++) {
        if (a[i] != a[0] || d[i] != d[0]) {
            flag = false;
            break;
        }
    }
    if (flag) {
        ans = max(ans, m);
        return;
    }
    for (int _ = 0; _ < 2 * m; _++) {
        int mx = 0;
        for (int &j : a) {
            mx = max(mx, j);
        }
        for (int j = mx; j < m; j++) {
            int lastm = m;
            vector<int> lasta = a;
            string lastd = d;
            m = j;
            f();
            a = lasta;
            d = lastd;
            m = lastm;
        }
        for (int j = 0; j < n; j++) {
            if (d[j] == 'R') a[j]++;
            if (d[j] == 'L') a[j]--;
            if (a[j] == 1) d[j] = 'R';
            if (a[j] == m) d[j] = 'L';
        }
        bool flag = true;
        for (int i = 1; i < n; i++) {
            if (a[i] != a[0] || d[i] != d[0]) {
                flag = false;
                break;
            }
        }
        if (flag) {
            ans = max(ans, m);
            return;
        }
    }
}

void sol() {
    cin >> T >> n >> m;
    string sans = "Yes\n";
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] % 2 != a[0] % 2) {
            sans = "No\n";
        }
    }
    cin >> d;
    cout << sans;
    if (T == 1) return;
    if (sans == "No\n") return;
    f();
    cout << ans << '\n';
    return;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    sol();
    return 0;
}
