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

    function<void(int, int, int)> func = [&](int ind, int jump, int now_m) {
        if (s[ind] == now_m) c[ind] = 'L';
        else if (s[ind] == 1) c[ind] = 'R';
        int first = (c[ind] == 'L' ? s[ind] - 1 : now_m - s[ind]);
        s[ind] += (c[ind] == 'R' ? 1 : -1) * min(first, jump);
        jump -= min(first, jump);

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

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

        if (cnt && c[ind] == 'R') s[ind] = now_m - jump - 1;
        else if (cnt && c[ind] == 'L') s[ind] = jump + 1;
        if (cnt & 1) c[ind] = (c[ind] == 'L' ? 'R' : 'L');

        if (jump != 0) func(ind, jump, now_m);
    };

    vector<pair<int, int>> ans;

    int now_m = m;
    int time = 0;

    for (int i = 0; i < m + 1; i++) {
        bool all = true;
        for (int j = 1; j < n; j++) {
            if (s[j] != s[j - 1]) {
                all = false;
            }
        }

        if (all) break;

        int mines = 1e9;
        for (int j = 0; j < n; j++) {
            int oper = 0;

            if (c[j] == 'R') oper += now_m - s[j] + 1;
            else {
                if (s[j] >= now_m - 1) oper = s[j] - now_m + 1;
                else oper = s[j] - 1 + now_m;
            }

            mines = min(mines, oper);
        }

        bool flag = true;

        for (int j = 0; j < n; j++) {
            func(j, mines, now_m);
            if (s[j] == now_m) flag = false;
        }

        time += mines;
        
        now_m--;
        ans.emplace_back(time, now_m);
    }

    cout << "Yes\n";
    cout << (int)(m - (int)ans.size()) << '\n';

    if (t == 3) {
        cout << (int)ans.size() << '\n';

        for (auto [fir, sec]: ans) {
            cout << fir << ' ' << sec << '\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();
}
