//#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();
    }
}

ll ans = 0;
ll n;
void rec(ll m, ll t, vector<ll> a, string s) {
    if (t >= 10) {
        return;
    }
    vector<ll> f1(m), f2(m);
    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') {
            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) {
        ans = max(ans, m);
        return;
    }

    if (f1[m - 1] == 0 && f2[m - 1] == 0) {
        rec(m - 1, t + 1, a, s);
    }
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            a[i]--;
        } else {
            a[i]++;
        }
    }
    rec(m, t + 1, a, s);
}

void solve() {
    ll T, 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;
    }

    vector<pair<ll, ll>> moments;
    for (int i = 0; i < 4 * m; i++) {
        if (a[0] == a[1]) {
            moments.emplace_back(a[0] + 1, i);
        }
        for (int j = 0; j < 2; j++) {
            if (s[j] == 'L') {
                a[j]--;
                if (a[j] == 0) {
                    s[j] = 'R';
                }
            } else {
                a[j]++;
                if (a[j] == m - 1) {
                    s[j] = 'L';
                }
            }
        }
    }
    sort(moments.rbegin(), moments.rend());
    cout << moments[0].first << '\n';
    if (T == 2) {
        return;
    }

    if (moments[0].first == m) {
        cout << 0;
    } else {
        cout << 1 << '\n';
        cout << moments[0].second << ' ' << moments[0].first;
        return;
    }
}
