#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;
}

pair <int, bool> go(pair <int, bool> a, int t, int m) {
    t %= (2 * m - 2);
    if (!a.s) {
        a = go({m - a.f + 1, 1}, t, m);
        return {m - a.f + 1, !a.s};
    }
    if (m - a.f <= t)
        return go({m, 0}, t - (m - a.f), m);
    return {a.f + t, a.s};
}

template <class T>
T max(vector <T> v) {
    assert(v.size());
    return *max_element(v.begin(), v.end());
}

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;
        }
        pair <int, int> ans = max(f(a[0], b[0], a[1], b[1], m)); // (pos, time)
        cout << ans.f << nl;
        if (t == 3)
            cout << 1 << nl << ans.s << " " << ans.f;
        return 0;
    }
    // t >= 2
    vector <int> t0, tt;
    vector <pair <int, int>> ans;
    vector <pair <int, bool>> st, st2;
    for (int i = 0; i < n; ++i)
        st.pb({a[i], b[i]});
    sort(st.begin(), st.end());
    st.resize(unique(st.begin(), st.end()) - st.begin());
    int tme = 0;
    while (st.size() > 1) {
        pair <int, int> mx = {-1, -1};
        t0.clear();
        for (int i = 0; i < st.size(); ++i)
            if (i < 100 || st.size() - 100 <= i)
                t0.pb(i);
            else
                tt.pb(i);
        shuffle(tt.begin(), tt.end(), rnd);
        for (int i = 0; i < tt.size() && i < 100; ++i)
            t0.pb(tt[i]);
        for (int i : t0)
            for (int j = i + 1; j < st.size(); ++j)
                mx = max(mx, max(f(st[i].f, st[i].s, st[j].f, st[j].s, m)));
        for (auto u : st) {
            u = go(u, mx.s, m);
            if (u.f == mx.f)
                u.s = 0;
            st2.pb(u);
        }
        tme += mx.s;
        ans.pb({tme, mx.f});
        sort(st2.begin(), st2.end());
        st2.resize(unique(st2.begin(), st2.end()) - st2.begin());
        st = st2;
        st2.clear();
        m = mx.f;
    }
    cout << m << nl;
    if (t == 2)
        return 0;
    // t >= 3
    cout << ans.size() << nl;
    for (auto u : ans)
        cout << u.f << " " << u.s << nl;
}
/*
3
2 4
2 2
LL

3
2 4
1 3
RR

3
3 5
1 3 5
RRL
*/
