#include "bits/extc++.h"

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define ordered_set tree<long long, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

random_device rd;
mt19937 rnd(rd());

// #pragma GCC optimize("O3", "unorll-loops")
// #pragma GCC target("avx2", "bmi", "bmi2", "popcnt", "lzcnt")

int rand(int l, int r) {
    if (r < l)
        assert(false);
    return uniform_int_distribution<int>(l, r)(rnd);
}

void solve() {
    int t, n, m;
    cin >> t >> n >> m;

    int odd = 0, even = 0;

    vector<int> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        if (s[i] & 1) odd++;
        else even++;
    }

    if (even && odd) {
        cout << "No\n";
        return;
    }

    string c;
    cin >> c;

    if (t == 1) {
        cout << "Yes\n";
        return;
    }

    auto func = [&](int ind, int jump, int now_m) {
        int oper = (c[ind] == 'L' ? s[ind] - 1 : now_m - s[ind]);
        int first = min(jump, oper);
        jump -= first;
        s[ind] += (c[ind] == 'L' ? -1 : 1) * min(first, oper);

        if (s[ind] == 1 || s[ind] == now_m) {
            c[ind] = (c[ind] == 'L' ? 'R' : 'L');
        }

        if (jump == 0) return;

        int cnt = jump / (now_m - 1);
        jump %= (now_m - 1);

        if (cnt & 1) s[ind] = (s[ind] == 1 ? now_m : 1);

        s[ind] += (c[ind] == 'L' ? -1 : 1) * jump;

        if (s[ind] == 1 || s[ind] == now_m) {
            c[ind] = (c[ind] == 'L' ? 'R' : 'L');
        }
    };

    if (s[0] > s[1]) swap(s[0], s[1]), swap(c[0], c[1]);

    int oper = 0;
    
    if (s[0] != 'R' || s[1] != 'L') {
        int fir = (c[0] == 'L' ? s[0] - 1 : m - s[0]);
        int sec = (c[1] == 'R' ? s[1] - 1 : m - s[1]);
        oper = min(fir, sec);

        func(0, oper, m);
        func(1, oper, m);
    }

    int len = (s[1] - s[0] + 1); 
    m = len;

    if (t == 2) {
        cout << "Yes\n";
        cout << s[0] + (1 + m) / 2 - 1 << '\n';
        return;
    }

    cout << "Yes\n";
    cout << (m + 1) / 2 + s[0] - 1 << '\n';
    cout << 1 << '\n';
    cout << oper + m / 2 << ' ' << (m + 1) / 2 + s[0] - 1 << '\n';
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("answer.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int akbalin = 1;
    // cin >> akbalin;

    while (akbalin--) solve();
}
