#include <bits/stdc++.h>
#include <immintrin.h>

using namespace std;
using ll = long long;

#define x first
#define y second
#define all(x) x.begin(), x.end()

void solve();

int main() {
    // cin.tie(nullptr)->sync_with_stdio(false);

    cout << fixed << setprecision(20);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}

void solve() {
    int T;
    cin >> T;
    int n;
    ll m;
    cin >> n >> m;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i]; a[i]--;
    }
    string str;
    cin >> str;
    for (int i = 0; i < n; i++) {
        if (str[i] == 'L') {
            a[i] = m - 1 + m - 1 - a[i];
        }
    }
    sort(all(a));
    for (int i = 0; i < n; i++) {
        if ((a[i] - a[0]) % 2) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
    if (T == 1) return;
    ll mx = 0;
    for (int i = 0; i < n; i++) {
        mx = max(mx, (a[(i + 1) % n] + 2 * m - 2 - a[i]) % (2 * m - 2));
    }
    cout << (mx + 2) / 2 << '\n';
    if (T == 2) return;
}
