#include <bits/stdc++.h>

#define fi first
#define se second
#define pb push_back
#define ppb pop_back
#define pw(x) ((1LL)<<(x))
#define sz(x) (ll)x.size()
#define all(x) x.begin(), x.end()

using ll = long long;
using ld = long double;

using namespace std;

const ll N = 5e5 + 52;
const ll INF = 1e18;
const ll MOD = 998244353;

ll n, m;
ll i, j;
string s;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif // LOCAL
    ll t;
    cin >> t;
    cin >> n >> m;
    vector<ll> a(n);
    set<ll> b;
    set<ll> c;
    for (i=0;i<n;i++){
        cin >> a[i];
        c.insert(a[i]);
        b.insert(a[i]%2);
    }
    a.clear();
    for (auto x : c){
        a.pb(x);
    }
    cin >> s;
    for (auto x : s){
        if (x=='L') exit(-1);
    }
    if (sz(b)>1){
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    if (t==1) return 0;
    ll r = a.back();
    ll l = a[sz(a)-2];
    vector<pair<ll,ll>> ans;
    ll x = (m-r)+(l+r)/2;
    ll tm = x-l;
    ans.pb({tm,x});
    for (i=sz(a)-3;i>-1;i--){
        a[i]+=tm;
        x = (a[i]+x)/2;
        tm += x-a[i];
        ans.pb({tm,x});
    }
    cout << x << endl;
    if (t==2) return 0;
    cout << sz(ans) << endl;
    for (auto [t,x] : ans){
        cout << t << " " << x << endl;
    }
    return 0;
}
