#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1e18 + 7;
int main() {
    cin.tie(0)->sync_with_stdio(0);
    ll T;
    cin >> T;
    ll n, m;
    cin >> n >> m;
    vector<ll>a(n);
    for (ll i = 0; i < n; ++i) cin >> a[i];
    string s;
    cin >> s;
    ll cnt = 0;
    for (auto x : a) {
        cnt += x & 1;
    }
    if (cnt != 0 && cnt != n) {
        cout <<"No\n";
        return 0;
    }
    cout <<"Yes\n";
    if (a[0] == a[1] && s[0] == s[1]) {
        if (T == 2) {
            cout <<m<<"\n";
            return 0;
        }
        if (T == 3) {
            cout <<m<<"\n"<<0<<"\n";
            return 0;
        }
        return 0;
    }
    ll x = a[0], y = a[1];
    ll c, d;
    if (s[0] == 'L') c = 0;
    else c = 1;
    if (s[1] == 'R') d = 1;
    else d = 0;
    ll lft = m, rgt = 0;
    ll lftt = 0, rgtt = 0;
    ll timer = 0;
    for (ll i = 0; i < 3e7; ++i) {
        if (x < y && c == 1 && d == 0 || x > y && c == 0 && d == 1) {
            ll pos = (x + y) / 2;
            timer += abs(x - y) / 2;
            if (lft > pos) {
                lft = pos;
                lftt = timer;
            }
            if (rgt < pos) {
                rgt = pos;
                rgtt = timer;
            }
            if (c == 1) {
                x = pos + 1;
                y = pos - 1;
            }
            else {
                x = pos - 1;
                y = pos + 1;
            }
            timer++;
            if (x == m + 1) {x = m - 1; c = 0;}
            if (y == 0){y = 2; d = 1;}
            if (y == m + 1) {y = m - 1; d = 0;}
            if (x == 0){x = 2; c = 1;}
        }


        if (c == d && c == 1) {
            ll t = min(m - y, m - x);
            timer += t;
            y = t + y;
            x = t + x;
            if (x == m){c = 0;}
            if (y == m) {d = 0;}
        }
        else if (c == d && c == 0) {
            ll t = min(y - 1,  x - 1);
            timer += t;
            y = -t + y;
            x = -t + x;
            if (x == 1){c = 1;}
            if (y == 1) {d = 1;}
        }
    }
    //cout <<rgt<<' '<<lft<<"\n";
    if (T == 2) {
        cout <<max(rgt, m - lft + 1)<<"\n";
    }
    if (T == 3) {
        if (max(rgt, m - lft + 1) == m) {
            cout <<m<<"\n"<<"0\n";
            return 0;
        }
        cout <<max(rgt, m - lft + 1)<<"\n"<<"1\n";
        if (rgt > m - lft + 1) {
            cout <<rgtt<<' '<<rgt<<'\n';
        }
        else {
            cout <<lftt<<' '<<m - lft + 1<<"\n";
        }

    }

}