#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define f first
#define s second
#define pb push_back
#define pf push_front
#define in insert
#define elif else if
#define nl '\n'

typedef __int128 int128;
typedef long double ld;
#define  long  int64_t
#define ulong uint64_t
#define uint  uint32_t

using namespace std;
using namespace __gnu_pbds;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long

const int N = 2e5 + 9;

bool b[N];
int t, n, m, a[N];

vector <pair <int, int>> pls(vector <pair <int, int>> v, int t) {
    for (auto &u : v)
        u.s += t;
    return v;
}

vector <pair <int, int>> f(int a0, bool b0, int a1, bool b1, int m) { // (pos, time)
    assert(a0 != a1 || b0 != b1);
    if (b0 == b1) {
        if (a0 > a1) {
            swap(a0, a1);
            swap(b0, b1);
        }
        if (!b0)
            return pls(f(1, 1, a1 - (a0 - 1), 0, m), a0 - 1);
        else
            return pls(f(a0 + (m - a1), 1, m, 0, m), m - a1);
    }
    // b0 != b1
    if (a0 > a1) {
        swap(a0, a1);
        swap(b0, b1);
    }
    if (!b0)
        if (a0 - 1 < m - a1)
            return pls(f(1, 1, a1 + (a0 - 1), 1, m), a0 - 1);
        else
            return pls(f(a0 - (m - a1), 0, m, 0, m), m - a1);
    // a0 < a1
    int pos = (a0 + a1) / 2, tme = (a1 - a0) / 2;
    vector <pair <int, int>> v = {{pos, tme}};
    if (pos != m - pos + 1)
        v.pb({m - pos + 1, tme + m - 1});
    return v;
}

int32_t main() {
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> t >> n >> m;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i) {
        char c;
        cin >> c;
        b[i] = (c == 'R');
    }
    bool ok = 1;
    for (int i = 1; i < n; ++i)
        ok &= (a[0] % 2 == a[i] % 2);
    if (!ok) {
        cout << "No";
        return 0;
    }
    cout << "Yes\n";
    if (t == 1)
        return 0;

    if (n == 2) {
        if (a[0] == a[1] && b[0] == b[1]) {
            cout << m << nl;
            if (t == 3)
                cout << 0;
            return 0;
        }
        vector <pair <int, int>> v = f(a[0], b[0], a[1], b[1], m); // (pos, time)
        v = {*max_element(v.begin(), v.end())};
        cout << v.back().f << nl;
        if (t == 3) {
            cout << v.size() << nl;
            for (auto u : v)
                cout << u.s << " " << u.f << nl;
        }
        return 0;
    }
    // t >= 2
    if (t == 2)
        return 0;
    // t >= 3
}
/*
3
2 4
2 2
LL

3
2 4
1 3
RR
*/
