# include <iostream>
using namespace std;

const int INF=1e9;
const int MAX=2e5+11;

int T;
int n,m;
int a[MAX];
char dir[MAX];

pair<int,pair<long long,int>> ans={0,{-1,-1}};

void simulate(long long t, int p, bool spec=0)
{
    if(p>1000) return ;

    if(dir[1]==dir[2])
    {
        if(dir[1]=='L')
        {
            int cnt=min(a[1],a[2])-1;
            t+=cnt;
            a[1]-=cnt;
            a[2]-=cnt;
            if(a[1]<a[2]) dir[1]='R';
            else dir[2]='R';
        }
        else
        {
            int cnt=m-max(a[1],a[2]);
            t+=cnt;
            a[1]+=cnt;
            a[2]+=cnt;
            if(a[1]>a[2]) dir[1]='L';
            else dir[2]='L';
        }
        simulate(t,p+1);
    }
    else
    {
        if(!spec and ((a[1]<=a[2] and dir[1]=='R') or (a[1]>=a[2] and dir[1]=='L')))
        {
            int d=abs(a[1]-a[2]);
            int mp=(a[1]+a[2])/2;
            int cnt=d/2;
            t+=cnt;
            ans=max(ans,{mp,{t,mp}});
            a[1]=mp;
            a[2]=mp;
            simulate(t,p+1,1);
        }
        else
        {
            int d1=0;
            if(dir[1]=='L') d1=a[1]-1;
            else d1=m-a[1];

            int d2=0;
            if(dir[2]=='L') d2=a[2]-1;
            else d2=m-a[2];

            int d=min(d1,d2);
            t+=d;
            if(dir[1]=='L') a[1]-=d;
            else a[1]+=d;
            if(dir[2]=='L') a[2]-=d;
            else a[2]+=d;

            if(d==d1)
            {
                if(dir[1]=='L') dir[1]='R';
                else dir[1]='L';
            }
            if(d==d2)
            {
                if(dir[2]=='L') dir[2]='R';
                else dir[2]='L';
            }

            simulate(t,p+1);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    cin>>T;
    cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>dir[i];

    bool f[2]={0,0};
    for(int i=1;i<=n;i++) f[a[i]%2]=1;
    if(f[0] and f[1]) {cout<<"No"<<"\n";return 0;}
    cout<<"Yes"<<"\n";
    if(T==1) return 0;

    if(a[1]==a[2] and dir[1]==dir[2]) ans={m,{-1,-1}};
    else simulate(0,0);

    cout<<ans.first<<"\n";
    if(T==2) return 0;
    if(ans.second.first==-1)
    {
        cout<<0<<"\n";
        return 0;
    }
    cout<<1<<"\n";
    cout<<ans.second.first<<" "<<ans.second.second<<"\n";

    return 0;
}

