#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll=long long;
#define int ll

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define fi first
#define sc second

void solve() {
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    vector<int> ind;
    vector<int> a(n);
    for (auto &i : a) cin >> i;
    string tmp;
    cin >> tmp;
    for (int i = 0; i < n; i++) {
        if (tmp[i] == 'R') {
            a[i] = (a[i] - 1);
        } else {
            a[i] = (2 * m - 1 - a[i]);
        }
    }
    sort(all(a));
    a.resize(unique(all(a)) - a.begin());
    n = a.size();
    int d = 0;
    int mxind = 0;
    int len_c = 2 * m - 2;
    vector<int> dd(n);
    for (int i = 0; i < n; i++) {
        int curd = (a[(i + 1) % n] - a[i] + len_c) % (len_c);
        dd[i] = curd;
        if (curd % 2) {
            d = -1;
            break;
        } else {
            if (d < curd) {
                mxind = i;
                d = curd;
            }
        }
    }
    if (d == -1) {
        cout << "No\n";
        return;
    } else {
        cout << "Yes\n";
    }
    if (t > 1) {
        if (n == 1) {
            cout << m << "\n";
        } else {
            cout << (d / 2) + 1 << "\n";
        }
    }
    if (t > 2) {
        cout << n - 1 << "\n";
        int t = (m - 1 - a[mxind] + len_c) % len_c;
        int j = mxind;
        while (j != ((mxind + 1) % n)) {
            int indn = (j + n - 1) % n;
            t += (dd[indn] / 2);
            m -= (dd[indn] / 2);
            cout << t << " " << m << "\n";
            j = indn;
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}
