#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using ll = long long;
using namespace std;
using namespace __gnu_pbds;
template<class  T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class  T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
struct SegTree {
    vector<ll> t, add, a;
    ll sz;
    SegTree(vector<ll> v) {
        sz = v.size();
        a = v;
        t.resize(4*sz);
        add.resize(4*sz);
        build(1, 0, sz);
    }
    void build(ll v, ll tl, ll tr) {
        if (tl+1==tr) {
            t[v]=a[tl];
        }
        else {
            ll tm = (tl+tr)/2;
            build(2*v, tl, tm);
            build(2*v+1, tm, tr);
            t[v]=t[2*v]+t[2*v+1];
        }
    }
    void push(ll v, ll tl, ll tr) {
        t[v]+=add[v]*(tr-tl);
        if (tl+1!=tr) {
            add[2*v]+=add[v];
            add[2*v+1]+=add[v];
        }
        add[v]=0;
    }
    ll get(ll l, ll r) {
        return _get(1, 0, sz, l, r);
    }
    ll _get(ll v, ll tl, ll tr, ll l, ll r) {
        push(v, tl, tr);
        if (tl==l&&tr==r)return t[v];
        ll tm = (tr+tl)/2;
        if (r<=tm)return _get(2*v, tl, tm, l, r);
        if (l>=tm)return _get(2*v+1, tm, tr, l, r);
        return _get(2*v, tl, tm, l, tm)+_get(2*v+1, tm, tr, tm, r);
    }
    void update(ll l, ll r, ll val) {
        _update(1, 0, sz, l, r, val);
    }
    void _update(ll v, ll tl, ll tr, ll l, ll r, ll val) {
        push(v, tl, tr);
        if (l<=tl&&tr<=r) {
            add[v]+=val;
            push(v, tl, tr);
            return;
        }
        if (l>=tr||tl>=r)return;
        ll tm = (tl+tr)/2;
        _update(2*v, tl, tm, l, r, val);
        _update(2*v+1, tm, tr, l, r, val);
        t[v]=t[2*v]+t[2*v+1];
    }
};
template<typename T, typename U>
istream &operator>>(istream &in, pair<T, U> &p) {
    in>>p.first>>p.second;
    return in;
}
template<typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> p) {
    out<<p.first<<" "<<p.second<<"\n";
    return out;
}
template<typename T>
istream &operator>>(istream &in, vector<T> &v) {
    for (int i = 0; i<v.size(); i++)in>>v[i];
    return in;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> v) {
    for (auto &x: v)out<<x<<" ";
    return out;
}

vector<ll> prefix_func(string s) {
    ll n = s.size();
    vector<ll> prefix(n);
    prefix[0]=0;
    for (int i = 1; i<n; i++) {
        ll j = prefix[i-1];
        while (j>0&&s[i]!=s[j]) {
            j = prefix[j-1];
        }
        if (s[i]==s[j])j++;
        prefix[i]=j;
    }
    return prefix;
}
vector<ll> z_func(string s) {
    ll n = s.size();
    vector<ll> z(n, 0);
    ll l = 0, r = -1;
    for (int i = 1; i<n; i++) {
        z[i]=min(max(r-i+1, 0ll), z[i-l]);
        while (i+z[i]<n&&s[i+z[i]]==s[z[i]])z[i]++;
        if (i+z[i]-1>r) {
            l = i;
            r = i+z[i]-1;
        }
    }
    z[0]=n;
    return z;
}
struct st {
    ll d, mn, mx;
};
// void move(vector<ll> &v, string &s, ll m) {
//     for (int i = 0; i<v.size(); i++) {
//         if (s[i]=='R') {
//             v[i]++;
//             if (v[i]==m-1) {
//                 s[i]='L';
//             }
//         }
//         else {
//             v[i]--;
//             if (v[i]==0) {
//                 s[i]='R';
//             }
//         }
//     }
// }
void move(vector<ll> &v, string &s, ll m, ll time) {
    for (int i = 0; i<v.size(); i++) {
        ll time1 = time;
        while (time1>0) {
            if (s[i]=='R') {
                ll tme = m-1-v[i];
                if (tme>time1) {
                    v[i]+=time1;
                    time1 = 0;
                }
                else {
                    v[i]=m-1;
                    s[i]='L';
                    time1-=tme;
                }
            }
            else {
                ll tme = v[i];
                if (tme>time1) {
                    v[i]-=time1;
                    time1 = 0;
                }
                else {
                    v[i]=0;
                    s[i]='R';
                    time1-=tme;
                }
            }
        }

    }
}
void solve() {
    ll gr;
    cin>>gr;
    ll n, m;
    cin>>n>>m;
    vector<ll> v(n);
    cin>>v;
    for (int i = 0; i<n; i++)v[i]--;
    for (int i = 0; i<n-1; i++) {
        if (v[i]%2!=v[i+1]%2) {
            cout<<"No\n";
            return;
        }
    }
    cout<<"Yes\n";
    if (gr==1)return;
    string s;
    cin>>s;
    ll t = 0;
    if (s[0]=='R') {
        t = m-1+m-1-v[0];
    }
    else {
        t = v[0];
    }
    move(v, s, m, t);
    if (v[0]!=0)cout<<1/0;
    if (s[1]=='L') {
        t+=v[1]/2;
        move(v, s, m, v[1]/2);
    }
    else {
        t+=(m-1+m-1-v[1])/2;
        move(v, s, m, (m-1+m-1-v[1])/2);
    }
    if (v[0]!=v[1])cout<<1/0;
    // cout<<t<<"\n";
    // cout<<v<<"\n";
    ll ans = 0;
    if (s[0]==s[1]) {
        ans = m;
        cout<<m<<"\n";
    }
    else {
        ans = max(v[0]+1, m-v[0]);
        cout<<max(v[0]+1, m-v[0])<<"\n";
    }
    if (gr==2)return;
    if (ans==m) {
        cout<<0<<"\n";
    }
    else {
        cout<<1<<"\n";
        if (ans==v[0]+1) {
            cout<<t<<" "<<ans<<"\n";
        }
        else {
            t+=m;
            move(v, s, m, m);
             if (v[0] != v[1])cout << 1 / 0;
             if (v[0]!=ans)cout<<1/0;
            cout<<t<<" "<<ans<<"\n";
        }
    }

}
signed main() {
#ifdef home
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    ll t=1;
    //cin>>t;
    while (t--)solve();
}