#include <bits/stdc++.h>
using namespace std;

mt19937 rnd(time(0));
#define int long long
constexpr int MAXN = 2e5 + 5;
void solve(){
    int tpp;
    cin >> tpp;
    int n, m;
    cin >> n >> m;
    int cnt0 = 0, cnt1 = 0;
    vector <int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
        if (a[i] % 2 == 0){
            cnt0++;
        }
        else{
            cnt1++;
        }
    }

    if (cnt0 != 0 && cnt1 != 0){
        cout << "No" << '\n';
        return;
    }
    string s;
    cin >> s;
    if (m == 1){
        cout << "Yes" << '\n';
        if (tpp != 1){
            cout << m << '\n';
        }
        if (tpp == 3){
            cout << 0 << '\n';
        }
        return;
    }
    vector <int> tp(n);
    for (int i = 0; i < n; i++){
        if (s[i] == 'L'){
            tp[i] = -1;
        }
        else{
            tp[i] = 1;
        }
    }
    sort(a.begin(), a.end());
    vector <int> b;
    b.push_back(a[0]);
    for (int i = 1; i < n; i++){
        if (a[i - 1] != a[i]){
            b.push_back(a[i]);
        }
    }
    a = b;
    n = a.size();
    cout << "Yes" << '\n';
    if (n == 1){
        if (tpp != 1){
            cout << m << '\n';
            if (tpp != 2){
                cout << 0 << '\n';
            }
        }
        return;
    }
    vector <pair <int, int>> sp;
    int t = 0;
    int x1 = a[n - 2];
    int x2 = a[n - 1];
    t += m - x2;
    int y1 = x1 + m - x2;
    int y2 = m;
    t += (y2 - y1 ) / 2;
    int mid = (y1 + y2) / 2;
    a[n - 2] = mid;
    a[n - 1] = mid;
    sp.push_back({t, mid});
    m = mid;
    for (int i = n - 3; i > -1; i--){
        a[i] += t;
        int x1 = a[i];
        int x2 = a[i + 1];
        int mid = (x1 + x2) / 2;
        t += mid - x1;
        a[i] = mid;
        a[i + 1] = mid;
        sp.push_back({t, mid});
        m = mid;
    }
    if (tpp != 1){
        cout << m << '\n';
        if (tpp == 3){
            cout << sp.size() << '\n';
            for (auto v: sp){
                cout << v.first << " " << v.second << '\n';
            }
        }
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    while (t--){
        solve();
    }
}




