#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> oset;
using ll = long long;
mt19937 rnd(52);
ll mod = 998244353;
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
#endif
    ll t;
    cin >> t;
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    bool f = true;
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
        if ((a[i]-a[0])%2 != 0) {
            f = false;
        }
    }
    string s;
    cin >> s;
    if (!f) {
        cout << "No\n";
        return 0;
    }
    if (t == 1) {
        cout << "Yes\n";
        return 0;
    }
    cout << "Yes\n";
    vector<ll> pos;
    for (ll i = 0; i < n; i++) {
        if (s[i] == 'R') {
            pos.push_back(a[i]);
        } else {
            pos.push_back(m-1+(m-1)-a[i]);
        }
    }
    sort(pos.begin(), pos.end());
    pos.erase(unique(pos.begin(), pos.end()), pos.end());
    ll ma = 0;
    vector<ll> otr;
    ll l, r;
    for (ll i = 0; i < pos.size(); i++) {
        ll p1 = pos[i];
        ll p2;
        if (i!=pos.size()-1) {
            p2 = pos[i+1];
            otr.push_back(p2-p1);
        } else {
            p2 = pos[0]+2*m-2;
            l = p1;
            r = p2;
        }
        ma = max(ma, p2-p1);
    }
    cout << ma/2+1 << endl;
    if (t == 2) {
        return 0;
    }
    ll len = 2*m-2;
    ll center = (r+l)/2;
    vector<pair<ll, ll>> ans;
    ll sd = (r-l)/2;
    if (r-l != ma) {
        ans.push_back({(len/2-center+len)%len, ((len-(r-l))/2+1)});
        len = len-(r-l);
    } else {
        sd = (r-l)/2;
    }
    ll curt = (len/2-center+len)%len;
    reverse(otr.begin(), otr.end());
    ll ind = -1;
    for (ll i = 0; i < otr.size(); i++) {
        if (r-l != ma and otr[i] == ma) {
            ind = i;
            break;
        }
    }
    for (ll i = 0; i < otr.size(); i++) {
        if (i == ind) {
            sd+=otr[i];
            continue;
        }
        curt+=sd+otr[i]/2;
        ans.push_back({curt, (len-otr[i])/2+1});
        len = len-otr[i];
        sd = 0;
    }
    cout << ans.size() << endl;
    for (auto [x, y] : ans) {
        cout << x << ' ' << y << endl;
    }
    return 0;
}