#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;

    vector<pair<int, int>> b;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        b.push_back({a[i], i});
    }

    sort(b.begin(), b.end());

    bool subR = 1;
    string s, t; cin >> t;

    s = t;
    for (int i = 0; i < n; ++i) {
        s[i] = t[b[i].second - 1];
    }

    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 (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;
    }
    
    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";
        }

        return 0;
    }
    if (n == 2) {
        vector<pair<int, int>> isec;
        
        int it = 100 * m, timer = 0;
        while (--it) {
            ++timer;

            if (s[0] == 'L') a[1]--;
            else a[1]++;

            if (a[1] == m) s[0] = 'L';
            if (a[1] == 1) s[0] = 'R';

            if (s[1] == 'L') a[2]--;
            else a[2]++;

            if (a[2] == m) s[1] = 'L';
            if (a[2] == 1) s[1] = 'R';

            if (a[1] == a[2]) {
                isec.push_back({a[1], timer});
            }
        }

        sort(isec.begin(), isec.end());

        if (T >= 2) {
            cout << isec.back().first;
        }

        if (T == 3) {
            cout << 1 << "\n";
            cout << isec.back().first << " " << isec.back().second << "\n";
        }

        return 0;
    }

    return 0;
}
