//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <experimental/random>

using namespace std;
using ll = long long;
using ld = long double;

const ll INF = 1e18, MOD = 998244353;

void solve();

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll q = 1;
    // cin >> q;
    while (q--) {
        solve();
    }
}

void solve() {
    ll T, n, m;
    cin >> T >> n >> m;
    bool f1 = false, f2 = false;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        ll x; cin >> x;
        a[i] = x - 1;
        if (x % 2 == 0) {
            f1 = true;
        } else {
            f2 = true;
        }
    }
    string s;
    cin >> s;
    if (f1 && f2) {
        cout << "No";
        return;
    } else {
        cout << "Yes\n";
    }

    if (T == 1) {
        return;
    }

    ll t = 0;
    vector<pair<ll, ll>> ans;
    for (ll _ = 0; _ < n; _++) {
        vector<ll> f1(m), f2(m);
        bool flag = false;
        for (ll i = 0; i < n; i++) {
            if (a[i] >= m) {
                while (true);
            }
            if (s[i] == 'L') {
                f1[a[i]]++;
            } else {
                f2[a[i]]++;
            }
            if (f1[a[i]] == n || f2[a[i]] == n) {
                flag = true;
            }
        }
        if (flag) {
            break;
        }

        vector<pair<ll, char>> ax;
        for (ll i = 0; i < n; i++) {
            ax.emplace_back(a[i], s[i]);
        }
        sort(ax.begin(), ax.end());
        ax.resize(unique(ax.begin(), ax.end()) - ax.begin());
        vector<pair<ll, ll>> moments;
        ll lt = -INF, ld = INF;
        ll rt = -INF, rd = INF;
        for (auto [id, c] : ax) {
            if (c == 'L') {
                if (lt != -INF) {
                    ll col = (id - lt) / 2;
                    ll tm = lt + (id - lt) / 2;
                    if (col > m - col - 1) {
                        moments.emplace_back(col + 1, tm);
                    } else {
                        moments.emplace_back(m - col, tm + m - 1);
                    }
                }
                if (ld != INF) {
                    ll col = (id - ld) / 2;
                    ll tm = ld + (id - ld) / 2;
                    if (col > m - col - 1) {
                        moments.emplace_back(col + 1, tm);
                    } else {
                        moments.emplace_back(m - col, tm + m - 1);
                    }
                }
                if (rt != -INF) {
                    ll col = (id + rt) / 2;
                    ll tm = (id - rt) / 2;
                    if (col > m - col - 1) {
                        moments.emplace_back(col + 1, tm);
                    } else {
                        moments.emplace_back(m - col, tm + m - 1);
                    }
                }
                if (rd != INF) {
                    ll col = (id + rd) / 2;
                    ll tm = (id - rd) / 2;
                    if (col > m - col - 1) {
                        moments.emplace_back(col + 1, tm);
                    } else {
                        moments.emplace_back(m - col, tm + m - 1);
                    }
                }
                lt = max(lt, id);
                ld = min(ld, id);
            } else {
                if (rt != -INF) {
                    ll res = id - rt;
                    ll col = m - (res / 2) - 1;
                    ll tm = res / 2 + (m - 1 - id);
                    if (col > m - col - 1) {
                        moments.emplace_back(col + 1, tm);
                    } else {
                        moments.emplace_back(m - col, tm + m - 1);
                    }
                }
                if (rd != INF) {
                    ll res = id - rd;
                    ll col = m - (res / 2) - 1;
                    ll tm = res / 2 + (m - 1 - id);
                    if (col > m - col - 1) {
                        moments.emplace_back(col + 1, tm);
                    } else {
                        moments.emplace_back(m - col, tm + m - 1);
                    }
                }
                rt = max(rt, id);
                rd = min(rd, id);
            }
        }


        sort(moments.rbegin(), moments.rend());
        auto [nxt, tm] = moments.front();
        for (ll j = 0; j < tm; j++) {
            for (ll i = 0; i < n; i++) {
                if (s[i] == 'L') {
                    a[i]--;
                } else {
                    a[i]++;
                }
                if (a[i] == 0) {
                    s[i] = 'R';
                }
                if (a[i] == m - 1) {
                    s[i] = 'L';
                }
            }
        }
        if (nxt != m) {
            m = nxt;
            ans.emplace_back(nxt, tm + t);
        }
        for (ll i = 0; i < n; i++) {
            if (a[i] == 0) {
                s[i] = 'R';
            }
            if (a[i] == m - 1) {
                s[i] = 'L';
            }
        }
        t += tm;
    }
    cout << m << '\n';
    if (T == 2) {
        return;
    }

    cout << ans.size() << '\n';
    for (auto [x, y] : ans) {
        cout << y << ' ' << x << '\n';
    }
}
