#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }
    string s;
    cin >> s;
    vector<int> pos(n);
    for(int i = 0; i < n; i++){
        if(s[i] == 'R'){
            pos[i] = a[i];
        }else{
            pos[i] = 2 * m - a[i] - 2;
        }
    }

    for(int i = 0; i < n; i++){
        if(pos[i] % 2 != pos[0] % 2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    if(t == 1){
        return 0;
    }

    for(int i = 0; i < n; i++){
        pos[i] /= 2;
    }
    sort(pos.begin(), pos.end());
    int mx = 0;
    for(int i = 0; i < n - 1; i++){
        mx = max(mx, pos[i + 1] - pos[i]);
    }
    mx = max(mx, m + pos[0] - pos[n - 1]);
    cout << mx << endl;
    if(t == 3){
        cout << 1 << endl;
        cout << mx - 1 << " " << mx << endl;
    }
}
