#include <bits/stdc++.h>

#define int long long

using namespace std;

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

    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    string s;
    cin >> s;

    bool ok = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] % 2 != a[0] % 2) {
            ok = 0;
        }
    }

    if (!ok) {
        cout << "No\n";
        return 0;
    }

    cout << "Yes\n";

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

    sort(a.begin(), a.end());

    int sv = a[0] - a[n - 1] + m - 1;
    for (int i = 0; i < n - 1; i++) {
        sv = max(sv, a[i + 1] - a[i]);
    }

    if (T >= 2) {
        cout << sv + 1 << "\n";
    }
}
