#include <bits/stdc++.h>
using namespace std;
#define int long long
const int inf = 1e18;
const int T = 20;
bool cur_check(vector<int> &a, string &s) {
    bool check = true;
    int n = a.size();
    for (int i = 1; i < n; i++) {
        if (a[i] != a[i - 1]) {
            check = false;
        }
    }
    for (int i = 1; i < n; i++) {
        if (s[i] != s[i - 1]) {
            check = false;
        }
    }
    return check;

}
int mxv = -inf;
bool check(vector<int> a, string s, int m, vector<int> &cnts) {
    int crs = m;
    int n = a.size();
    for (int i = 0; i < m - 1; i++) {
        if (cnts[i] != -1) {
            crs = min(crs, i + 1);
        }
    }
    if (cur_check(a, s)) {
        mxv = max(mxv, crs);
        return true;
    }
    for (int t = 0; t < T; t++) {
        for (int j = 0; j < m - 1; j++) {
            if (cnts[j] == t) {
                m = min(m, j + 1);
            }
        }
        for (int i = 0; i < n; i++) {
            if (a[i] > m) return false;
            if (a[i] == m) {
                s[i] = 'L';
            }else if (a[i] == 1) {
                s[i] = 'R';
            }
            if (s[i] == 'R') {
                a[i]++;
            }else {
                a[i]--;
            }
        }
        if (cur_check(a, s)) {
            mxv = max(mxv, crs);
            return true;
        }
    }
    return false;
}
void rec(vector<int> &a, string &s, int i, int m, vector<int> &cnts) {
    if (i == m - 1) {
        check(a, s, m, cnts);
        return;
    }
    for (int j = -1; j < T; j++) {
        cnts[i] = j;
        rec(a, s, i + 1, m, cnts);
    }
}
signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int T;
    cin >> T;
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    set<int> curs;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        curs.insert(a[i] % 2);
    }
    string s;
    cin >> s;
    bool check = true;
    for (int i = 1; i < n; i++) {
        if (a[i] != a[i - 1]) {
            check = false;
        }
    }
    for (int i = 1; i < n; i++) {
        if (s[i] != s[i - 1]) {
            check = false;
        }
    }
    if (check) {
        cout << "Yes\n";
        if (T >= 2) {
            cout << m <<'\n';
            if (T >= 3) {
                cout << 0 << '\n';
            }
        }
        return 0;
    }
    if (curs.size() > 1) {
        cout << "No\n";
    }else {
        int mxv = -inf, mnv = inf;
        for (auto i : a) {
            mxv = max(mxv, i);
            mnv = min(mxv, i);
        }
        vector<pair<int, int>> pt;
        pt.push_back({0, mxv});
        int tm = 0;
        sort(a.begin(), a.end());
        for (int i = n - 2; i > -1; i--) {
            int z = a[n - 1] - tm;
            int len = (z - a[i]);
            len /= 2;
            a[i] += len;
            tm += len;
            pt.push_back({tm, a[i]});
        }
        cout << "Yes\n";
        if (T >= 2) {
            cout << pt.back().second << '\n';
            if (T >= 3) {
                cout << pt.size() << '\n';
                for (auto i : pt) {
                    cout << i.first + 1 << " " << i.second << '\n';
                }
            }
        }
    }
}

