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

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    int c = 2*m - 2;
    vector<int> a(n);
    for(int &x : a){
        cin >> x;
        --x;
    }
    string s;
    cin >> s;
    for(int i = 0; i < n; ++i){
        if(s[i] == 'R') a[i] *= -1;
        if((a[i] - a[0])%2 != 0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    if(t == 1) return 0;
    sort(a.begin(), a.end());
    n = unique(a.begin(), a.end()) - a.begin();
    a.resize(n);
    vector<int> b(n);
    int ans = b[n - 1] = (c - a[n - 1] + a[0])/2, j = n - 1;
    for(int i = 0; i < n - 1; ++i){
        int x = b[i] = (a[i + 1] - a[i])/2;
        if(x > ans){
            j = i;
            ans = x;
        }
    }
    cout << ans + 1 << endl;
    if(t == 2) return 0;
    cout << n - 1 << endl;
    int p = -c, tt = 0;
    for(int i = 0; i < n; ++i){
        if(i != j){
            int x = a[i] + b[i];
            tt += x - p;
            m -= b[i];
            cout << tt << ' ' << m << endl;
            p = a[i] + 2*b[i];
        }
    }
}