//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
#include <experimental/random>

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

//#define int long long

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

mt19937 rnd(503462350);

struct node {
    string s;
    vector<int> a;
    int n;
    int timer;
};
const int inf = 1e13;

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin>>T;
    int n, m;
    cin>>n>>m;
    vector<int>a(n);
    for(auto &i:a) {
        cin>>i;
    }
    string s; cin >> s;
    int timer=0;
    int mx = -inf;
    pair<int,int>op = {-1,-1};
    while(timer<5e8 && mx==-inf) {
        if (a[0]==a[1]) {
            if (s[0]==s[1]) {
                if (m>mx) {
                    mx=m;
                    op = {timer, m};
                }
            } else {
                if (a[0]>mx) {
                    mx=a[0];
                    op={timer,a[0]};
                }
            }
        }
        timer++;
        for (int i = 0; i < n; ++i) {
            if (s[i] == 'L') {
                if (a[i] == 2) {
                    s[i] = 'R';
                }
                a[i]--;
            } else {
                if (a[i] == m - 1) {
                    s[i] = 'L';
                }
                a[i]++;
            }
        }
        if (a[0]==a[1]) {
            if (s[0]==s[1]) {
                if (m>mx) {
                    mx=m;
                    op = {timer, m};
                }
            } else {
                if (a[0]>mx) {
                    mx=a[0];
                    op={timer,a[0]};
                }
            }
        }
    }
    if (mx<0) {
        cout<<"No";
    } else{
        cout<<"Yes\n";
        if (T>1) {
            cout<<mx<<'\n';
            if (T>2) {
                cout<<"1\n";
                cout<<op.first<<' '<<op.second;
            }
        }
    }
}



