// #pragma GCC optimize("Ofast")

#include <iostream>
#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define all(x) x.begin(), x.end()

#ifdef DEBUG
    #define debug(x) {cout << __func__ << ":" << __LINE__ << " " << #x << " = " << x << "\n";};
    #define debugw(x) {cout << __func__ << ":" << __LINE__ << " " << x << "\n";};
#else
    #define debug(x)
    #define debugw(x)
#endif

#define int ll

const int N = 2e5 + 1;

int T, n, m;

int a[N];
// 0 - left
// 1 - right
int dir[N];

vector<int> states;

int i2s(int pos, int dir) {
    int res = 0;
    if (dir == 1) {
        res = pos;
    } else {
        res = 2 * m - pos - 2;
    }
    return res;
}

int distance(int v, int u) {
    if (v > u) {
        return 2 * m - 2 - (v - u);
    } else {
        return u - v;
    }
}

void solve() {
    cin >> T >> n >> m;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }

    for (int i = 0; i < n; i++) {
        char c;
        cin >> c;
        dir[i] = (c == 'R');
    }

    bool fl = true;

    for (int i = 1; i < n; i++) {
        if ((a[i] - a[i - 1]) % 2 == 1) {
            fl = false;
            break;
        }
    }

    if (!fl) {
        cout << "No\n";
        return;
    } 

    cout << "Yes\n";

    if (T == 1) return;

    states.resize(n);
    for (int i = 0; i < n; i++) {
        states[i] = i2s(a[i], dir[i]);
    }

    sort(all(states));

    fl = true;

    int mx = 0;
    for (int i = 0; i < n; i++) {
        int nxt = (i + 1) % n;
        if (states[i] != states[nxt]) {
            fl = false;
        }
        mx = max(mx, distance(states[i], states[nxt]));
    }

    int res;
    if (fl) {
        res = m;
    } else {
        res = (mx + 2) / 2;
    }
    cout << res << "\n";

    if (T == 2) return;

    cout << 1 << "\n";
    cout << (m / 2) << " " << (m + 1) / 2 << "\n";
}

signed main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);

    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    // cout << set_precision(8) << fixed;

    // ll T;
    // cin >> T;
    // while (T--) solve();

    solve();
}