#include <experimental/random>
#include <bits/stdc++.h>

using namespace std;
//experimental::randint(1, 10);
#define ll long long

ll MOD = 998244353;
ll INF = 1e18;

pair<ll,ll> norm(ll x,ll tp,ll m) {
    if (x < m - (x - 1)) {
        return {m - (x - 1), tp + m - 1};
    }
    return {x, tp};
}

pair<ll,ll> dist(ll l,ll r, char v1, char v2,ll m) {
    if (l > r) {
        swap(l, r);
        swap(v1, v2);
    }
    if (v1 == v2) {
        ll d = (r - l) / 2;
        if (v1 == 'L') {
            return norm(1 + d, l - 1 + d, m);
        }
        return norm(m - d, m - r + d, m);
    }
    if (v1 == 'R') {
        ll x = (r + l) / 2;
        ll dd = (r - l) / 2;
        return norm(x, dd, m);
    }
    ll f1 = l - 1;
    ll f2 = m - r;
    char v3 = v1, v4 = v2;
    ll dd = min(f1, f2);
    if (l - dd == 1) {
        v3 = 'R';
    }
    if (r + dd == m) {
        v4 = 'L';
    }
    l -= dd;
    r += dd;
    return dist(l, r, v3, v4, m);
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll tt;
    cin >> tt;
    ll n, m;
    cin >> n >> m;
    vector<ll> s(n);
    vector<ll> col(2);
    for (ll i = 0; i < n; i++) {
        cin >> s[i];
        col[s[i] % 2]++;
    }
    string z;
    cin >> z;
    if (col[0] != 0 && col[1] != 0) {
        cout << "No";
        return 0;
    }
    cout << "Yes" << endl;
    if (tt == 1) {
        return 0;
    }
    pair<ll,ll> answer = dist(s[0], s[1], z[0], z[1], m);
    cout << answer.first << endl;
    if (tt == 2) {
        return 0;
    }
    cout << 1 << endl;
    cout << answer.second  << " " << answer.first;
}
