#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,bmi2")
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    int n;
    cin >> n;
    int m;
    cin >> m;
    int a[n + 1];
    set<int>s;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        s.insert((a[i] & 1));
    }
    if (s.size() == 1) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
        exit(0);
    }
    if (t == 1) {
        exit(0);
    }
    char c[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> c[i];
    }
    int CURM = m;
    vector<pair<int, int> >ans;
    int o = 0;
    while (1) {
        // if (o > 50) {
        //     break;
        // }
        int mx = 0;
        set<pair<int, char> >et;
        for (int i = 1; i <= n; i++) {
            if (a[i] == 1) {
                c[i] = 'R';
            }
            if (a[i] == CURM) {
                c[i] = 'L';
            }
            et.insert({a[i], c[i]});
            mx = max(mx, a[i]);
        }
        if (et.size() == 1) {
            break;
        }
        if (mx < CURM) {
            ans.push_back({o, mx});
            CURM = mx;
        }
        o++;
        for (int i = 1; i <= n; i++) {
            if (a[i] == 1) {
                c[i] = 'R';
            }
            if (a[i] == CURM) {
                c[i] = 'L';
            }
            if (c[i] == 'R') {
                a[i]++;
            } else {
                a[i]--;
            }
        }
    }
    cout << CURM << endl;
    if (t == 2) {
        exit(0);
    }
    cout << ans.size() << endl;
    for (auto [a, b] : ans) {
        cout << a << ' ' << b << endl;
    }
}