#include<bits/stdc++.h>

#define int long long

using namespace std;

pair<int, int> f_c(vector<int> a, string s, int m) {
    if (s[0] == 'R' && s[1] == 'L') return {(a[1] - a[0]) / 2, (a[1] + a[0]) / 2};
    //cout << -1 << endl;
    if (s[0] == 'L' && s[1] == 'L') {
        int nt = a[0];
        s[0] = 'R';
        s[1] = 'L';
        a[1] -= nt;
        a[0] -= nt;
        auto [tm, x] = f_c(a, s, m);
        return {tm + nt, x};
    }
    if (s[0] == 'R' && s[1] == 'R') {
        int nt = m - a[1];
        s[0] = 'R';
        s[1] = 'L';
        a[1] += nt;
        a[0] += nt;
        auto [tm, x] = f_c(a, s, m);
        return {tm + nt, x};
    }
    if (a[0] < m - a[1]) {
        int nt = a[0];
        a[0] -= nt;
        a[1] += nt;
        a[0] = 'R';
        a[1] = 'R';
        auto [tm, x] = f_c(a, s, m);
        return {tm + nt, x};
    } else {
        int nt = m - a[1];
        a[0] -= nt;
        a[1] += nt;
        a[0] = 'L';
        a[1] = 'L';
        auto [tm, x] = f_c(a, s, m);
        return {tm + nt, x};
    }
}

signed main() {
    ios_base::sync_with_stdio();
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    string s;
    cin >> s;
    if (t == 1) {
        sort(a.begin(), a.end());
        int fl = 1;
        vector<int> ch(2);
        for (int i = 0; i < n; ++i) {
            ch[a[i] % 2] = 1;
        }
        if (ch[0] == 0 || ch[1] == 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
        return 0;
    }
    if (n == 2) {
        vector<int> ch(2);
        for (int i = 0; i < n; ++i) {
            ch[a[i] % 2] = 1;
        }
        if (ch[0] == 0 || ch[1] == 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
            return 0;
        }
        if (a[0] > a[1]) {
            swap(a[0], a[1]);
            swap(s[0], s[1]);
        }
        auto [tm, x] = f_c(a, s, m);
        if (t > 1) {
            cout << x << endl;
        }
        if (t > 2) {
            cout << 1 << endl;
            cout << tm << " " << x << endl;
        }
    }
    return 0;
}
