
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

using namespace std;
using ll = long long;
using ld = long double;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long

int m;

void answ(int x, int y, int z, int w) {
    int x1 = (z - x + 2 * m - 2) % (2 * m - 2);
    y = (y + x1) % (2 * m - 2);
    if (w == 0) {
        if (y < z || (y - z >= 2 * (m - 1 - z) - 1)) {
            cout << x1 << " " << m - (m - 1 - z) << endl;
            exit(0);
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    int n;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    string s;
    cin >> s;
    int ans = -1;
    int s1 = 0;
    int s2 = 0;
    for (int i = 0; i < n; i++) {
        int x = 0;
        if (s[i] == 'R') {
            x = a[i] - 1;
        } else {
            x = m - 1 + (m - a[i]);
        }
        if (i == 0) {
            s1 = x;
        } else {
            s2 = x;
        }
        if (ans == -1 || ans == (x % 2)) {
            ans = x % 2;
        } else {
            cout << "No";
            exit(0);
        }
    }
    cout << "Yes" << "\n";
    if (t == 1) {
        exit(0);
    }
    if (s1 == s2) {
        cout << 0 << "\n";
    } else {
        int x = ((s2 + 2 * m - 2 - s1) % (2 * m - 2)) / 2;
        cout << m - x << "\n";
        if (t == 3) {
            cout << 1 << "\n";
            answ(s1, s2, m - 1 - x, 0);
            answ(s2, s1, m - 1 - x, 0);
        }
    }
}

