#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using ld=long double;
using ull=unsigned long long;
using lll=__int128;

#ifdef LOCAL
#define deb(x) cout<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
#else
#define deb(x)
#endif
#define all(x) x.begin(), x.end()
#define arr(x) x.rbegin(), x.rend()
#define int ll
int get(vector<int>& a, int m, int s, string& g, int s1) {
    int beg=0, end=m-1;
    deque<pair<int,int>> l,r;
    int n=a.size();
    for (auto i=0; i<n; ++i) {
        if (g[i]=='L') l.push_back({a[i]-1,i});
        else r.push_back({m-a[i],i});
    }
    sort(all(l));
    sort(all(r));
    int t=0;
    while (l.size()+r.size()>1) {
        if (l.size() && (r.size()==0 || r.back().first<m-l[0].first) && l[0].first+beg<=s) {
            beg+=l[0].first;
        }
        if (r.size() && (l.size()==0 || l.back().first<m-r[0].first) && end-r[0].first>=s1) {
            end-=r[0].first;
        }
        if (r[0].first<l[0].first) {
            for (auto& i: r) i.second-=0;
        }
    }
}
signed main(){
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T;
    cin>>T;
    int n,m;
    cin>>n>>m;
    vector<int> a(n);
    for (auto i=0; i<n; ++i) cin>>a[i];
    for (auto i=0; i<n; ++i) {
        if ((a[i]+a[0])%2) {
            cout<<"No";
            exit(0);
        }
    }
    string g;
    cin>>g;
    if (T==1) {
        cout<<"Yes";
        exit(0);
    }
    cout<<"Yes\n";
    if (n<=2) {
        int t=0;
        if (g[0]=='R') {
            t=m-a[0];
            g[0]='L';
            a[0]=m;
        }
        t+=a[0]-1;
        a[0]=1;
        if (g[1]=='R') {
            a[1]+=t;
            if (a[1]>=m) {
                a[1]=2*m-a[1];
                g[1]='L';
            }
            if (a[1]<=0) {
                a[1]=2-a[1];
                g[1]='R';
            }
            
        }else {
            a[1]-=t;
            if (a[1]<=0) {
                a[1]=2-a[1];
                g[1]='R';
            }
            if (a[1]>=m) {
                a[1]=2*m-a[1];
                g[1]='L';
            }
        }
        g[0]='R';
        if (g[1]=='R') {
            t+=m-a[1];
            a[0]+=m-a[1];
            a[1]=m;
        }
        int x=(a[0]+a[1])/2;
        t+=x-a[0];
        if (x<m-x+1) {
            t+=2*m-a[0]-a[1];
            x=m-x+1;
        }
        cout<<x<<'\n';
        if (T==3) cout<<1<<'\n'<<t<<' '<<x;
    }
}
