#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using ld=long double;
using ull=unsigned long long;
using lll=__int128;

#ifdef LOCAL
#define deb(x) cout<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
#else
#define deb(x)
#endif
#define all(x) x.begin(), x.end()
#define arr(x) x.rbegin(), x.rend()
#define int ll

signed main(){
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T;
    cin>>T;
    int n,m;
    cin>>n>>m;
    vector<int> a(n);
    for (auto i=0; i<n; ++i) cin>>a[i];
    for (auto i=0; i<n; ++i) {
        if ((a[i]+a[0])%2) {
            cout<<"No";
            exit(0);
        }
    }
    cout<<"Yes\n";
    if (T==1) {
        exit(0);
    }
    string g;
    cin>>g;
    deque<int> l,r;
    m--;
    for (auto i=0; i<n; ++i) {
        if (g[i]=='L') l.push_back(a[i]-1);
        else r.push_back(a[i]-1);
    }
    sort(all(l));
    sort(all(r));
    vector<pair<int,int>> an;
    int t=0;
    int cnt=0;
    while (l.size()+r.size()>1) {
        cnt++;
        while (l.size() && r.size() && r.back()<=l.back()) {
            int x=(l.back()+r.back())/2;
            cnt=0;
            int w=x-r.back();
            t+=w;
            an.push_back({t,x+1});
            m=x;
            for (auto& i: r) i+=w;
            for (auto& i: l) i-=w;
            while (l.size() && l[0]<=0) {
                r.push_front(-l[0]);
                l.pop_front();
            }
            while (r.size() && r.back()==m) {
                r.pop_back();
            }
        }
        if (cnt==2*m+5) {
            break;
        }
        if (l.size() && (r.size()==0 || l[0]<m-r.back())) {
            int w=l[0];
            t+=w;
            while (l.size() && l[0]==w) {
                l.pop_front();
                r.push_front(-w);
            }
            for (auto& i: r) i+=w;
            for (auto& i: l) i-=w;
        }else {
            int w=m-r.back();
            t+=w;
            while (r.size() && r.back()==m-w) {
                r.pop_back();
                l.push_back(m+w);
            }
            for (auto& i: r) i+=w;
            for (auto& i: l) i-=w;
        }
    }
    cout<<m+1<<endl;
    if (T==3){
        cout<<an.size()<<endl;
        for (auto i: an) cout<<i.first<<' '<<i.second<<endl;
    }
}
