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

using namespace std;
using namespace __gnu_pbds;

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


// #define double long double
#define int int_fast64_t
#define endl "\n"
#define ordered_set  tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

constexpr int MOD = 998244353;
constexpr int INF = 2e18;
constexpr int K = 3;
constexpr int P = 31;
constexpr double eps = 1e-9;
constexpr int MAXN = 30;
constexpr int MOD1 = (1ll << 61) - 1;

inline int pls(int a, int b) {
    if (a + b >= MOD1) return a + b - MOD1;
    return a + b;
}

inline int mns(int a, int b) {
    return pls(a, MOD1 - b);
}

inline int umn(int a, int b) {
    __int128 c = __int128(a) * b;
    return pls(c & MOD1, c >> 61);
}

int binpow(int n, int k, int mod) {
    if (!k) return 1;
    if (k & 1) return n * binpow(n, k ^ 1, mod) % mod;
    int c = binpow(n, k >> 1, mod);

    return c * c % mod;
}


// struct resh {
//     bool r[MAXN];
//
//     constexpr resh() {
//         for (int i = 0; i < MAXN; i++) {
//             r[i] = true;
//         }
//         r[1] = false;
//         for (int i = 2; i < MAXN; i++) {
//             if (!r[i]) continue;
//             for (int j = i * i; j < MAXN; j += i) {
//                 r[j] = false;
//             }
//         }
//     }
// };


bool check(vector<int> &a, string &s, int n) {
    int f = a.front();
    char c = s[0];
    for (int i = 0; i < n; i++) {
        if (a[i] != f || s[i] != c) return false;
    }
    return true;
}

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

    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    string s;
    int ch = 0, nch = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] & 1) ch++;
        else nch++;
    }
    cin >> s;
    if (ch && nch) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    if (T == 1) return 0;
    if (check(a, s, n)) {
        cout << m << endl;
        cout << 0 << endl;
        return 0;
    }
    vector<pair<int, int> > res;
    int timer = 0;
    while (true) {
        int found = -1;
        char t = 'R';
        for (int i = 0; i < n; i++) {
            if (found == -1 || a[found] < a[i]) {
                found = i;
                t = s[i];
            } else if (a[found] == a[i] && t != 'L' && s[i] == 'L') {
                found = i;
                t = 'L';
            }
        }
        if (t == 'R') {
            for (int i = 0; i < n; i++) {
                if (found == -1 || a[found] < a[i]) found = i;
            }
            int delta = m - a[found];
            timer += delta;
            for (int i = 0; i < n; i++) {
                if (s[i] == 'R') {
                    a[i] += delta;
                    if (a[i] == m) {
                        s[i] = 'L';
                        found = i;
                    }
                } else {
                    if (a[i] <= delta) {
                        a[i] = delta - a[i];
                        s[i] = 'R';
                    } else {
                        a[i] -= delta;
                    }
                }
            }
        }
        int found1 = -1;
        for (int i = 0; i < n; i++) {
            if (s[i] == 'L') continue;
            if (found1 == -1 || a[found1] > a[i]) found1 = i;
        }
        if (found1 == -1) {
            for (int i = 0; i < n; i++) {
                if (found1 == -1 || a[found1] > a[i]) found1 = i;
            }
            int delta = a[found1];
            timer += delta;
            for (int i = 0; i < n; i++) {
                a[i] -= delta;
                if (a[i] == 0) {
                    s[i] = 'R';
                    found1 = i;
                }
            }
        }
        int x = (a[found] + a[found1]) / 2;
        int pup = (a[found] - a[found1]) / 2;
        timer += pup;
        res.push_back({timer, x});
        for (int i = 0; i < n; i++) {
            if (s[i] == 'R') {
                s[i] = 'L';
                a[i] = x;
            } else {
                if (a[i] < pup) {
                    a[i] = pup - a[i];
                    s[i] = 'R';
                } else {
                    a[i] -= pup;
                }
            }
        }
        if (check(a, s, n)) {
            cout << res.back().second << endl;
            // cout << res.size() << endl;
            // for (auto [l, r] : res) {
            //     cout << l << " " << r << endl;
            // }
            return 0;
        }
    }
}
