#include <bits/stdc++.h>

using namespace std;

void solve();

// #include<ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#pragma GCC optimize("O3,Ofast,unroll-loops")

int main() {
#ifdef LOCAL
    freopen("input.txt", "r",stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    //cin>>t;
    while (t--) {
        solve();
    }
    return 0;
}

#define int long long
#define endl '\n'
const int N = 1e5+100, MOD = 998244353, INF = 2e18;
const double EPS = 1e-6, pi = acos(-1);
int add(int a,int b) {
    if (a+b>=MOD)return a+b-MOD;
    return a+b;
}
int sub(int a,int b) {
    if (a-b<0)return a-b+MOD;
    return a-b;
}
int mul(int a,int b) {
    return (a*b)%MOD;
}

void solve() {
    int t;
    cin>>t;
    int n,m;
    cin>>n>>m;
    vector<int> a(n);
    set<int> st;
    for (int i=0;i<n;i++) {
        cin>>a[i];
        st.insert(a[i]%2);
    }
    string s;
    cin>>s;
    if (st.size()==2) {
        cout<<"No"<<endl;
        return;
    }
    cout<<"Yes"<<endl;
    if (t==1)return;
    int time=0;
    int mx=0;
    int mxt=0;
    if (a[0]==a[1])mx=a[0];
    int cnt=10000*m;
    int curtime=0;
    while (cnt--) {
        if (s[0]=='L')a[0]--;
        else a[0]++;
        if (s[1]=='L')a[1]--;
        else a[1]++;
        if (a[0]==1)s[0]='R';
        if (a[1]==1)s[1]='R';
        if (a[0]==m)s[0]='L';
        if (a[1]==m)s[1]='L';
        curtime++;
        if (a[0]==a[1]) {
            if (a[0]>mx) {
                mx=a[0];
                mxt=curtime;
            }
        }
    }
    cout<<mx<<endl;
    if (t==2)return;
    cout<<1<<endl;
    cout<<mxt%(2*m-2)<<" "<<mx<<endl;
}
