#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>

using namespace std;
using ll = long long;
using ld = long double;

#define int ll

struct Node {
    int x;
    char d;

    bool operator<(const Node &that) const {
        return this->x < that.x;
    }

    bool operator==(const Node &that) const {
        return this->x == that.x && this->d == that.d;
    }
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int act;
    cin >> act;

    int n, m;
    cin >> n >> m;

    vector<Node> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].x;
        a[i].x--;
    }

    for (int i = 0; i < n; ++i) {
        if ((a[i].x - a[0].x) % 2 == 1) {
            cout << "No";
            return 0;
        }
    }

    string s;
    cin >> s;

    for (int i = 0; i < n; ++i)
        a[i].d = s[i];

    sort(a.begin(), a.end());
    a.resize(unique(a.begin(), a.end()) - a.begin());
    n = a.size();

    int t = 0;
    vector<pair<int, int>> qs;
    while (a.size() > 1) {
        int x1 = a[a.size() - 2].x;
        int x2 = a.back().x;
        x1 += t;
        x2 += t;

        int now = (m - x2 - 1) + (x2 - x1) / 2;
        m -= (x2 - x1) / 2;
        t += now;
        qs.push_back({t, m});
        a.pop_back();
    }

    cout << "Yes\n";
    if (act == 0) return 0;

    cout << m << '\n';
    if (act == 1) return 0;

    cout << qs.size() << '\n';
    for (auto el : qs)
        cout << el.first << " " << el.second << '\n';
}