#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()

void fast_in_out() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
#ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
}


const ll N=2e5+10;

ll a[N],a1[N];

mt19937 rnd(time(0));
int main() {
    fast_in_out();
    ll n,i,t,m,ans=0,j;
    string s,s1;
    cin >> t >> n >> m;
    for (i=0;i<n;i++)cin >> a[i];
    for (i=0;i<n-1;i++) {
        if (a[i]%2!=a[i+1]%2) {
            cout << "No\n";
            return 0;
        }
    }
    cin >> s;
    cout << "Yes\n";
    vector<pair<ll,ll>> ans1;
    if (t==1)return 0;
    ll cnt=1000;
    while (cnt--){
        i=rnd()%n;
        vector<pair<ll,ll>> p;
        for (j=0;j<n;j++)a1[j]=a[j];
        ll mn=m,x;
        s1=s;
        if (s[i]=='R')x=m-a[i];
        else
            x=a[i]-1+m-1;
        for (j=0;j<n;j++) {
            ll x1=x;
            while (x1>0) {
                if (s1[j]=='R') {
                    if (a1[j]+x1<m) {
                        a1[j]+=x1;
                        x1=0;
                    }else {
                        x1-=m-a1[j];
                        a1[j]=m;
                        s1[j]='L';
                    }
                }else {
                    if (a1[j]-x1>1) {
                        a1[j]-=x1;
                        x1=0;
                    }else {
                        x1-=a1[j]-1;
                        a1[j]=1;
                        s1[j]='R';
                    }
                }
            }
        }
        for (j=0;j<n;j++) {
            if (a1[j]==m)continue;
            ll curt=x,gr;
            if (s1[j]=='R') {
               gr=a1[j]+(m-a1[j])/2;
                curt+=(m-a1[j])/2;
            }else {
                gr=m-(a1[j]-1+(m-a1[j])/2);
                curt+=(a1[j]-1+(m-a1[j])/2);
            }
            mn=min(mn,gr);
            p.push_back({curt,gr});
        }
        if (ans<mn) {
            ans=mn;
            ans1=p;
        }
    }
    cout << ans << "\n";
    if (t==2)return 0;
    sort(ans1.begin(),ans1.end());
    cout << ans1.size() << "\n";
    for (auto u:ans1)cout << u.first << " " << u.second << "\n";
    return 0;
}