#define _GLIBCXX_FILESYSTEM
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2e5 + 10;
long long a[MAXN], b[MAXN];

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin >> t;
    
    long long n, m;
    cin >> n >> m;
    
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    for (int i = 1; i <= n; i++) {
        char ds;
        cin >> ds;

        b[i] = ds == 'R';
    }

    for (int i = 1; i <= n; i++) {
        if (a[i] % 2 != a[1] % 2) {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    if (t == 1) return 0;
    
    long long modulo = 2 * (m - 1);

    for (int i = 1; i <= n; i++) {
        a[i]--;
        if (b[i] == 0) a[i] = modulo - a[i];
    }

    sort(a + 1, a + n + 1);

    long long first = (a[2] - a[1] + modulo) % modulo;
    long long second = (a[1] - a[2] + modulo) % modulo;

    if (first > second) {
        swap(first, second);
        swap(a[1], a[2]);
    }

    cout << m - first / 2 << '\n';
    if (t == 2) return 0;

    if (first == 0) {
        cout << 0 << '\n';
        return 0;
    }

    cout << 1 << '\n';
    cout << (((m - 1 - first / 2) - a[1]) % modulo + modulo) % modulo << ' ' << m - first / 2 << '\n';
    
    return 0;

}