#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1e18 + 7;

void ans(int T,ll pos ,ll m,ll t) {
    cout <<max(pos, m - pos + 1)<<"\n";
    if (T == 2) {
        return;
    }
    if (max(pos, m - pos + 1) == m) {
        cout <<"0\n";
        return;
    }
    cout <<1<<"\n"<<t<<' '<<max(pos, m - pos  +1)<<"\n";
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    ll T;
    cin >> T;
    ll n, m;
    cin >> n >> m;
    vector<ll>a(n);
    for (ll i = 0; i < n; ++i) cin >> a[i];
    string s;
    cin >> s;
    ll cnt = 0;
    for (auto x : a) {
        cnt += x & 1;
    }
    if (cnt != 0 && cnt != n) {
        cout <<"No\n";
        return 0;
    }
    cout <<"Yes\n";
    if (T == 1) {
        return 0;
    }
    for (int i = 0; i < 2 * m; ++i) {
        for (int j = 0; j < n; ++j) {
            if (s[j] == 'R') {
                a[j]++;
            }
            else {
                a[j]--;
            }
            if (a[j] == m) s[j] = 'L';
            if (a[j] == 1) s[j] = 'R';
        }
        if (a[0] == a[1]) {
            ans(T, a[0], m, i + 1);
            return 0;
        }
    }
}
