// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("O3,unroll-loops")
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;
using ld = long double;
ll n, m;
ll f(ll x, ll to, bool t){
    if ((t&&(to>=x)) || ((!t) && (to <= x))){
        return abs(x-to);
    }
    ll ans = 0;
    if (t){
        ans = m - x;
        x = m;
    }
    else{
        ans = x - 1;
        x = 1;
    }
    return ans + abs(x - to);
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll T;
    cin>>T;
    cin>>n>>m;
    vector<ll> a(n);
    for (auto&e:a){cin>>e;}
    string s;
    cin>>s;
    ll t = a[0]%2;
    for (ll i = 1; i<n; i++){
        if (a[i]%2 != t){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    if (T == 1){return 0;}
    ll w = 0;
    if (s[0] == 'R'){
        w += m - a[0];
    }
    else{
        w += a[0] - 1;
    }
    if (s[1] == 'R'){
        w += a[1] - 1;
    }
    else{
        w += m-a[1];
    }
    if (s[0] == s[1]){
        if (((a[0] <= a[1]) && (s[0] == 'R')) || ((a[0] >= a[1]) && (s[0] == 'L'))){
            w = abs(a[0]-a[1]);
        }
        // else{
        //     w = m - abs(a[0]-a[1]);
        // }
    }
    w /= 2;
    ll ans = min(w+1, m - w);
    cout<<ans<<endl;
    if (T == 2){return 0;}
    cout<<1<<endl;
    if (w <= m/2){
        ll t = f(a[1], w+1, s[1] == 'R');
        cout<<t<<' '<<ans<<endl;
    }
    else{
        ll t = f(a[1], m-w, s[1] == 'R');
        cout<<t<<' '<<ans<<endl;
    }
    return 0;
}