#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define all(arr) arr.begin(), arr.end()
#define rall(arr) arr.rbegin(), arr.rend()

typedef long long ll;
typedef long double ld;
typedef __int128 lll;

mt19937_64 rnd(0);
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solve(){
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    vector<int> arr(n);
    for (int i = 0; i < n; i++){
        cin >> arr[i];
    }
    set<char> odd, even;
    vector<char> fck;
    for (int i = 0; i < n; i++){
        char ch;
        cin >> ch;
        if (arr[i] % 2 == 0){
            even.insert(ch);
        } else {
            odd.insert(ch);
        }
        fck.push_back(ch);
    }
    for (int i = 0; i < n; i++){
        if (arr[i] % 2 == 0){
            if (odd.empty()){
                continue;
            }
            cout << "No";
            return;
        } else {
            if (even.empty()){
                continue;
            }
            cout << "No";
            return;
        }
    }
    cout << "Yes\n";
    if (t == 1){
        return;
    }
    int ans = 0;
    int t_best = 0, x_best = 0;
    {
        for (int tm = 1; tm <= 10000000; tm++){
            set<int> x;
            for (int i = 0; i < n; i++){
                if (fck[i] == 'R'){
                    arr[i]++;
                    if (arr[i] == m){
                        fck[i] = 'L';
                    }
                } else {
                    arr[i]--;
                    if (arr[i] == 1){
                        fck[i] = 'R';
                    }
                }
                x.insert(arr[i]);
            }
            if (x.size() == 1){
                if ((*x.begin()) > ans){
                    ans = (*x.begin());
                    t_best = tm;
                    x_best = ans;
                }
            }
        }
    }
    cout << ans << '\n';
    if (t == 2){
        return;
    } 
    if (ans == m){
        cout << 0;
        return;
    }
    cout << "1\n" << t_best << ' ' << x_best;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(10);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--){
        solve();
        cout << '\n';
    }
    return 0;
}
