#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 5;

int a[N];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);

    int T; cin >> T;

    int n, m;
    cin >> n >> m;

    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    bool subR = 1;
    string s; cin >> s;
    for (int i = 0; i < n; ++i) {
        subR = (s[i] == 'L' ? 0 : subR);
    }

    sort(a + 1, a + n + 1);

    for (int i = 2; i <= n; ++i) {
        if ((a[i] - a[i - 1]) & 1) {
            cout << "No\n";
            return 0;
        }
    }
    
    cout << "Yes\n";
    
    if (n == 2 && a[1] == 1 && a[2] == m) {
        if (T >= 2) {
            cout << (m + 1) / 2 << "\n";
        }

        if (T == 3) {
            cout << 1 << "\n";
            cout << (m - 1) / 2 << " " << (m + 1) / 2 << "\n";
        }
    }

    if (subR) {
        bool diff = 0;
        for (int i = 2; i <= n; ++i) {
            if (a[i] != a[i - 1]) diff = 1;
        }

        if (!diff) {
            if (T >= 2) {
                cout << m << "\n";
            } if (T == 3) {
                cout << 0 << "\n";
            }
        }

        int t = m - a[n];

        int ptr = n;
        while (a[ptr] + t == m) {
            --ptr;
        }

        int mn = m;
        vector<pair<int, int>> move;
        for (int i = ptr; i >= 1; --i) {
            while (a[ptr] == a[i]) {
                --ptr;
            }

            int l = i, r = ptr + 1;
            
            t += (a[l + 1] - a[l]) / 2;
            move.push_back({t, a[l] + t});
            mn = min(mn, move.back().second);

            i = r;
        }

        if (T >= 2) {
            cout << mn << "\n";
        }

        if (T == 3) {
            cout << move.size() << "\n";
            for (auto& [a, b]: move) {
                cout << a << " " << b << "\n";
            }
        }
    }

    return 0;
}
