#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,bmi2")
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    int n;
    cin >> n;
    int m;
    cin >> m;
    int a[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    char c[n + 1];
    for (int j = 1; j <= n; j++) {
        cin >> c[j];
    }
    if (a[1] % 2 != a[2] % 2) {
        cout << "No\n";
        exit(0);
    } else {
        cout << "Yes\n";
    }
    if (t == 1) {
        exit(0);
    }
    int mx = -1, mxi, mxj;
    for (int o = 0; o <= 2 * m; o++) {
        bool ch = 0;
        for (int i = 1; i <= n; i++) {
            if (a[i] == 1) {
                c[i] = 'R';
            }
            if (a[i] == m) {
                c[i] = 'L';
            }
        }
        if (a[1] == a[2]) {
            if (a[1] > mx) {
                mx = a[1];
                mxi = o;
                mxj = a[1];
            }
        }
        for (int i = 1; i <= n; i++) {
            if (c[i] == 'L') {
                a[i]--;
            } else {
                a[i]++;
            }
        }
    }
    cout << mx << endl;
    cout << 1 << endl;
    cout << mxi << ' ' << mxj << endl;
    
}