#include <bits/stdc++.h>

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define cin(v) for (auto& vi : v) { cin >> vi; }
#define cout(v) for (auto& vi : v) { cout << vi << ' '; } cout << '\n';
#define int long long

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const int INF = 1e9 + 7;
const int MOD = 998244353;
const int MOD2 = 1e9 + 737373;
const ll LINF = 1e18 + 7;
const double eps = 1e-8;
const double PI = acos(-1);

int n, m;

int get_pos(int i, vector <int>& vec, vector <int>& dir) {
    int xi = vec[i];
    if (dir[i] == -1) {
        xi = 2LL * m - vec[i];
    }
    return xi;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(10);
    int T;
    cin >> T;
    cin >> n >> m;
    vector <int> vec(n), dir(n);
    cin(vec);
    string s;
    cin >> s;
    rep(i, n) {
        if (s[i] == 'L') {
            dir[i] = -1;
        }
        else {
            dir[i] = 1;
        }
    }
    string ANS = "Yes";
    for (int i = 0; i < n - 1; i++) {
        if (vec[i] % 2 != vec[i + 1] % 2) {
            ANS = "No";
            break;
        }
    }
    cout << ANS << '\n';
    if (ANS == "No") return 0;
    if (T >= 2) {
        vector <int> pos(n);
        for (int i = 0; i < n; i++) {
            int xi = vec[i];
            if (dir[i] == -1) {
                xi = 2LL * m - vec[i];
            }
            pos[i] = xi;
        }
        sort(all(pos));
        //cout(pos);
        int max_dist = 0;
        for (int i = 0; i < n - 1; i++) {
            max_dist = max(max_dist, pos[i + 1] - pos[i]);
        }
        max_dist = max(max_dist, 2LL * m - 2 - pos[n - 1] + pos[0]);
        //cout << max_dist << '\n';
        cout << m - (2LL * m - 2 - max_dist) / 2 << '\n';

        if (T >= 3) {
            if (n == 2) {
                if (vec[0] == vec[1] && dir[0] == dir[1]) {
                    cout << 0 << '\n';
                }
                else {
                    cout << 1 << '\n';
                    int t = 0;
                    if ((pos[0] + pos[1]) % (m * 2) != 0) {
                        t = m * 2 - (pos[0] + pos[1]) % (m * 2);
                    }
                    t /= 2;
                    int x = pos[0] + t;
                    while (x >= m * 2 - 1) {
                        x -= (m * 2 - 2);
                    }
                    if (x >= m) {
                        x = m * 2 - x;
                    }
                    int t2 = t + m - 1;
                    int x2 = pos[0] + t2;
                    while (x2 >= m * 2 - 1) {
                        x2 -= (m * 2 - 2);
                    }
                    if (x2 >= m) {
                        x2 = m * 2 - x2;
                    }
                    if (x >= x2) {
                        cout << t << ' ' << x << '\n';
                    }
                    else {
                        cout << t2 << ' ' << x2 << '\n';
                    }
                }
            }
        }
    }
    return 0;
}