#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 5e5 + 100;
const int mod = 998244353;
#define int long long
    int n, m;
array<int,3> get(int x, int y, char t1, char t2) {
    vector<int> a = {0, x, y};
    string s = " ";
    s += t1;
    s += t2;
    if (s[1] == 'R' && s[2] == 'L') {
        int len = (a[2] - a[1]) / 2 + a[1];
        int t = (a[2] - a[1]) / 2;
        return {len, t, 0};
    }
    else if (s[1] == 'L' && s[2] == 'R') {
        int k = max (m - a[2], a[1] - 1);
        a[1] -= k;
        if (a[1] <= 0) a[1] = 2 + abs (a[1]);
        a[2] += k;
        if (a[2] > m) a[2] = m - (a[2] - m);
        int len = (a[2] - a[1]) / 2 + a[1];
        int t = (a[2] -a[1]) / 2;
        return {len, t + k, 3};
    } else if (s[1] == 'R' && s[2] == 'R') {
        int k =m - a[2];
        a[1] += k;
        a[2] += k;
        int len = (a[2] - a[1]) / 2 + a[1];
        int t = (a[2] -a[1]) / 2;
        return {len, t + k, 2};
    } else if (s[1] == 'L' && s[2] == 'L') {
        int k = a[1] - 1;
        a[1] -= k;
        a[2] -= k;
        int len = (a[2] - a[1]) / 2 + a[1];
        int t = (a[2] -a[1]) / 2;
        return {len, t + k, 1};
    }

}
pair<int,int> getsolve (int x, int y, char t1, char t2) {
    vector<int> a = {0, x, y};
    string s = " ";
    s += t1;
    s += t2;
    if (a[1] > a[2]) {
        swap (a[1], a[2]);
        swap (s[1], s[2]);
    }
    vector<pair<int,int>> ans;
    if (a[1] == a[2] && s[1] == s[2]) {
        if (s[1] == 'L') ans.push_back({m, a[1] - 1 + m});
        else ans.push_back({m, m - a[1]});
    }
    int t = 0;
    int it = 0;
    while (it++ <= 2) {
        if (a[1] > a[2]) {
            swap (a[1], a[2]);
            swap (s[1], s[2]);
        }
        array<int,3> opt = get (a[1], a[2], s[1], s[2]);
        t += opt[1];
        a[1] = a[2] = opt[0];
        int mask = opt[2];
        if (mask & 1) {
            if (s[1] == 'L') s[1] = 'R';
            else s[1] = 'L';
        }
        if ((mask >> 1) & 1) {
            if (s[2] == 'L') s[2] = 'R';
            else s[2] = 'L';
        }
        ans.push_back({a[1], t});
        ++t;
        if (s[1] == 'L') --a[1];
        else ++a[1];
        if (s[2] == 'L') -- a[2];
        else ++a[2];
        if (a[1] > m) a[1] = m - 1;
        if (a[1] <= 0) a[1] = 2;
        if (a[2] > m) a[2] = m - 1;
        if (a[2] <= 0) a[2] = 2;
    }
    sort (rbegin (ans), rend (ans));
    return ans[0];
}
int ans;
map<pair<pair<vector<int>, string>,int>, bool>mp;
void rec (vector<int> a, string s, int mx) {
    if (mp.find({{a, s}, mx}) != mp.end()) return;
    bool bad = false, b2 = 0;
    mp[{{a, s}, mx}] = 1;
//    if (mx == 4) {
//        for (int i = 1; i <= n; ++i){
//            cout << a[i] << ' ';
//        }
//        cout << '\n';
//    }
    if (mx == 1) {
        ans = max (ans, mx);
        return;
    }
    for (int i = 1; i + 1 <= n; ++i) {
        if (a[i] != a[i + 1] || s[i] != s[i + 1]) {
            bad = 1;
        }
        if (a[i] != a[i + 1]) b2 = 1;
    }
    if (!bad) {
        ans = max (ans, mx);
        return;
    }
    if (!b2) {
        ans = max (ans, a[1]);
        return;
    }
    int X = 0;
    for (int i = 1; i <= n; ++i) {
        X = max (X, a[i]);
    }

    if (X > mx) assert(0);
    rec (a, s, X);
    for (int i = 1; i <= n; ++i) {
        if (s[i] == 'L') --a[i];
        else ++a[i];
        if (a[i] > mx) a[i] = mx - 1, s[i] = 'L';
        if (a[i] <= 0) a[i] = 2, s[i] = 'R';
    }
    rec (a, s, mx);
}
signed main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // LOCAL
    int T;
    cin >> T;
    cin >> n >> m;
    int c1 = 0, c2= 0;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        if (a[i] & 1) ++c1;
        else ++c2;
    }
    string s;
    cin >> s;
    s = " " + s;
    if (c1 && c2) {
        cout << "No\n";
        return 0;
    } else {
        cout << "Yes\n";
    }
    if (T == 1) return 0;
//    if (T == 2) {
//    if (n <= 3 && m <= 4) {
        rec (a, s, m);
        cout << ans << '\n';
//    }
//    else assert(0);
//    }


//    if (ans[0].first == m) {
//        cout << "0\n";
//    }
//    cout << mn << '\n';
}
