//#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 = 3e18, 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() {
    ll T, n, m;
    cin >> T >> n >> m;
    bool f1 = false, f2 = false;
    vector<ll> a(n);
    for (int 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;
    while (true) {
        vector<ll> f1(m), f2(m);
        for (int i = 0; i < n; i++) {
            if (s[i] == 'L') {
                f1[a[i]]++;
            } else {
                f2[a[i]]++;
            }
        }
        bool flag = false;
        for (int i = 0; i < n; i++) {
            if (f1[i] == n || f2[i] == n) {
                flag = true;
            }
        }
        if (flag) {
            break;
        }
        for (ll i = m - 1; i >= 0; i--) {
            if (!f1[i] && !f2[i]) {
                continue;
            }
            if (f1[i] && f2[i]) {
                m = i + 1;
                ans.emplace_back(t, m);
            }
            break;
        }

        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                s[i] = 'R';
            }
            if (a[i] == m - 1) {
                s[i] = 'L';
            }
            if (s[i] == 'L') {
                a[i]--;
            } else {
                a[i]++;
            }
        }
        t++;
    }
    cout << m << '\n';
    if (T == 2) {
        return;
    }

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