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

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

const int INF = 1e9, MOD = 998244353;

void solve();

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

void solve() {
    int T, n, m;
    cin >> T >> n >> m;
    bool f1 = false, f2 = false;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        int 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;
    }

    int t = 0;
    vector<pair<int, int>> ans;
    for (int _ = 0; _ < n; _++) {
        vector<int> f1(m), f2(m);
        bool flag = false;
        for (int i = 0; i < n; i++) {
            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<int, char>> ax;
        for (int i = 0; i < n; i++) {
            ax.emplace_back(a[i], s[i]);
        }
        sort(ax.begin(), ax.end());
        vector<pair<int, int>> moments;
        int lt = -INF, ld = INF;
        int 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 - 1) + (m - 1 - res)) / 2;
                    ll tm = (id - rt) / 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 - 1) + (m - 1 - res)) / 2;
                    ll tm = (id - rd) / 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 (int j = 0; j < tm; j++) {
            for (int 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 (int 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';
    }
}
