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

using namespace std;
//experimental::randint(1, 10);
#define ll long long

ll MOD = 998244353;
ll INF = 1e18;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll tt;
    cin >> tt;
    ll n, m;
    cin >> n >> m;
    vector<ll> s(n);
    vector<ll> col(2);
    for (ll i = 0; i < n; i++) {
        cin >> s[i];
        col[s[i] % 2]++;
    }
    string z;
    cin >> z;
    if (col[0] != 0 && col[1] != 0) {
        cout << "No";
        return 0;
    }
    cout << "Yes" << endl;
    if (tt == 1) {
        return 0;
    }
    vector<pair<ll,ll> > all;
    ll cc = 0;
    ll h = m;
    while (true) {
        ll mx = 0;
        ll td = 0;
        for (ll tm = cc; tm < h * 2 + cc; tm++) {
            for (ll i = 0; i < n; i++) {
                if (z[i] == 'R') {
                    s[i]++;
                    if (s[i] == h) {
                        z[i] = 'L';
                    }
                }
                if (z[i] == 'L') {
                    s[i]--;
                    if (s[i] == 1) {
                        z[i] = 'R';
                    }
                }
            }
            map<ll,ll> mp;
            for (ll i = 0; i < n; i++) {
                mp[s[i]]++;
            }
            if (mp.rbegin()->second > 1) {
                if (mx < mp.rbegin()->second) {
                    td = tm;
                }
                mx = max(mx, mp.rbegin()->second);
            }
        }
        all.push_back({td, mx});
        cc += m * 2;
        h = min(h, mx);
        map<ll,ll> mp;
        for (ll i = 0; i < n; i++) {
            mp[s[i]]++;
        }
        if (mp.size() == 1) {
            break;
        }
    }
    cout << h << endl;
    if (tt == 2) {
        return 0;
    }
    cout << all.size() << endl;
    for (ll i = 0; i < all.size(); i++) {
        cout << all[i].first + 1 << " " << all[i].second << endl;
    }
}
