#include <bits/stdc++.h>

using namespace std;

#define int long long

struct Segtree {
    vector<long long> t;
    int st = 1;
    void init(vector<int> a) {
        while (st < a.size()) st <<= 1;
        a.resize(st);
        t.resize(2 * st);
        for (int i = st; i < 2 * st; i++) t[i] = a[i - st];
        for (int v = st - 1; v >= 1; v--) t[v] = t[v * 2] + t[v * 2 + 1];
    }

    long long get(int v, int l, int r, int ql, int qr) {
        if (l >= qr or ql >= r) return 0;
        if (l >= ql and r <= qr) return t[v];
        int m = (r + l) / 2;
        return get(v * 2, l, m, ql, qr) + get(v * 2 + 1, m, r, ql, qr);
    }

    void up(int v) {
        v += st;
        t[v] = 0;
        while (v > 0) {
            v /= 2;
            t[v] = t[v * 2] + t[v * 2 + 1];
        }
    }

    long long f(int i, int lai) {
        swap(i, lai);
        if (lai < i) return get(1, 0, st, i + 1, lai); //i + 1 ... lai - 1
        else {
            return get(1, 0, st, lai + 1, st) + get(1, 0, st, 0, i); //lai + 1...n + 0...i - 1
        }
    }
};

Segtree tree;

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    bool f1 = false, f2 = false;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] % 2 == 0) f1 = true;
        else f2 = true;
    }
    if (f1 and f2) {
        cout << "No";
        return 0;
    }
    cout << "Yes" << '\n';
    if (t == 1) return 0;
    string s;
    cin >> s;
    set<int> pos;
    vector<int> pos2;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            if (a[i] < m) pos.insert(a[i] - 1 + m - 1);
            else pos.insert(0);
        } else {
            pos.insert(m - a[i]);
        }
    }
    for (auto x : pos) pos2.push_back(x);
    int cnt = pos.size();
    set<pair<int, int>> del;
    vector<int> del0;
    for (int i = 0; i + 1 < pos2.size(); i++) {
        del.insert({pos2[i + 1] - pos2[i], i});
        del0.push_back(pos2[i + 1] - pos2[i]);
    }
    int ladel1 = 2 * (m - 1) - (pos2.back() - pos2[0]), ladel2 = pos2.size() - 1;
    del.insert({ladel1, ladel2});
    del0.push_back(ladel1);
    tree.init(del0);
    vector<pair<long long, int>> ans;
    long long cut = 0, lai = -1, lax = -1;
    while (del.size() > 1) {
        auto [x, i] = *del.begin();
        del.erase(del.begin());
        if (lai != -1) {
            cut = cut + tree.f(i, lai) + x / 2;
            m -= x / 2;
            ans.push_back({cut, m});
        } else {
            cut = pos2[i];
            cut += x / 2;
            m -= x / 2;
            ans.push_back({cut, m});
        }
        tree.up(i);
        lai = i;
        lax = x;
        cnt--;
    }
    cout << m << '\n';
    if (t == 2) return 0;
    cout << ans.size() << '\n';
    for (auto [x, y] : ans) cout << x << " " << y << '\n';
}