# 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<int,int>> ans={0,{-1,-1}};

void simulate(int t)
{
    for(int i=1;i<=n;i++)
    {
        if(dir[i]=='R') a[i]++;
        else a[i]--;

        if(a[i]==m and dir[i]=='R') dir[i]='L';
        if(a[i]==1 and dir[i]=='L') dir[i]='R';
    }

    if(a[1]==a[2])
    {
        if(dir[1]==dir[2])
        {
            ans={m,{-1,-1}};
        }
        else
        {
            ans=max(ans,{a[1],{t,a[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;

    for(int t=1;t<=m*10;t++) simulate(t);
    cout<<ans.first<<"\n";
    if(T==2) return 0;
    cout<<1<<"\n";
    cout<<ans.second.first<<" "<<ans.second.second<<"\n";

    return 0;
}

