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

using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long long;
#define all(v) v.begin(), v.end()
#define int long long

typedef tree <int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 2e5+10;
const long long inf = 1e18+10;

int a[N];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    string s;
    cin >> s;
    int x = 0, y = 0;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            a[i] = (m-a[i]+1) + m-1;
        }
        if (a[i]%2 == 0) {
            x++;
        } else {
            y++;
        }
        v.push_back(a[i]);
    }
    if (x*y != 0) {
        cout << "No";
        return 0;
    }
    cout << "Yes\n";
    if (t <= 1) {
        return 0;
    }
    sort(all(v));
    int mx = 0, mxi = 0;
    for (int i = 0; i < v.size(); i++) {
        int dif = 0;
        if (i == v.size()-1) {
            dif = v[0]+m*2-2 - v[i];
        } else {
            dif = v[i+1]-v[i];
        }
        if (mx < dif) {
            mx = dif;
            mxi = i+1;
        }
    }
    cout << (mx+2)/2 << '\n';
    if (t <= 2) {
        return 0;
    }
    vector<int> vc;
    vector<pair<int, int>> ans;
    for (int i = mxi; i < v.size(); i++) {
        int dif = 0;
        if (i == v.size()-1) {
            dif = v[0]+m*2-2 - v[i];
        } else {
            dif = v[i+1]-v[i];
        }
        vc.push_back(dif);
    }
    for (int i = 0; i < mxi-1; i++) {
        int dif = 0;
        if (i == v.size()-1) {
            dif = v[0]+m*2-2 - v[i];
        } else {
            dif = v[i+1]-v[i];
        }
        vc.push_back(dif);
    }
    int b = a[mxi], cnt = m, tim = 0;
    for (int i: vc) {
        if (i == 0) {
            continue;
        }
        if (b <= cnt-i/2) {
            tim += cnt-i/2-b;
            b = cnt-i/2;
        } else {
            tim += cnt*2-2+cnt-i/2-b;
            b = cnt-i/2;
        }
        ans.push_back({tim, b});
        cnt -= i/2;
    }
    cout << ans.size() << '\n';
    for (auto p: ans) {
        cout << p.first << " " << p.second << '\n';
    }
    return 0;
}