#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


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;
    int n, m;
    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 (n == 2) {
        int it = 0;
        vector<pair<int,int>> ans;
        while (it < 50 * m) {
            if (a[1] == a[2]) {
                ans.push_back ({a[1], it});
            }
            ++it;
            if (s[1] == 'R') ++a[1];
            else --a[1];
            if (s[2] == 'R') ++a[2];
            else --a[2];
            if (a[1] > m) a[1] = m - 1, s[1] = 'L';
            if (a[1] <= 0) a[1] = 2 + abs(a[1]), s[1] = 'R';
            if (a[2] > m) a[2] = m - 1, s[2] = 'L';
            if (a[2] <= 0) a[2] = 2 + abs(a[2]), s[2] = 'R';
        }
        sort (rbegin (ans), rend (ans));
        cout << ans[0].first << '\n';
        if (T == 3) {
            cout << "1\n";
            cout << ans[0].second << ' ' << ans[0].first << '\n';
        }
        return 0;
    } else if (n == 1) {
        cout << m << '\n';
        if (T == 3) cout << "0\n";
        return 0;
    }
    assert(0);
//    int mn = m;
//    for (int i =1 ; i <= n; ++i) {
//        for (int j = i + 1; j <= n; ++j) {
//            int x = a[i], y = a[j];
//            int t1 = s[i] == 'R';
//            int t2 = s[j] == 'R';
//            if (x > y) swap (x, y), swap (t1, t2);
//            int p = m;
//            if (t1 && !t2) p =
//            mn= min (mn, p);
//        }
//    }
//    cout << mn << '\n';
}
