#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long
#define all(arr) arr.begin(), arr.end()
#define rall(arr) arr.rbegin(), arr.rend()

typedef long long ll;
typedef long double ld;
typedef __int128 lll;

mt19937_64 rnd(0);
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solve(){
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    vector<int> arr(n);
    for (int i = 0; i < n; i++){
        cin >> arr[i];
    }
    set<char> odd, even;
    vector<char> fck;
    for (int i = 0; i < n; i++){
        char ch;
        cin >> ch;
        if (arr[i] % 2 == 0){
            even.insert(ch);
        } else {
            odd.insert(ch);
        }
        fck.push_back(ch);
    }
    for (int i = 0; i < n; i++){
        if (arr[i] % 2 == 0){
            if (odd.empty()){
                continue;
            }
            cout << "No";
            return;
        } else {
            if (even.empty()){
                continue;
            }
            cout << "No";
            return;
        }
    }
    sort(all(arr));
    cout << "Yes\n";
    if (t == 1){
        return;
    }
    int tm = m - arr.back();
    int c = m;
    vector<pair<int, int>> answer;
    while (!arr.empty() && arr.back() + tm == c){
        arr.pop_back();
    }
    while (!arr.empty()){
        int nw = (c + arr.back() + tm) / 2;
        answer.push_back({tm + c - nw, nw});
        tm += c - nw;
        c = nw;
        while (!arr.empty() && arr.back() + tm == c){
            arr.pop_back();
        }
    }
    cout << c << '\n';
    if (t == 2){
        return;
    }
    cout << answer.size() << '\n';
    for (auto e : answer){
        cout << e.first << ' ' << e.second << '\n';
    }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(10);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--){
        solve();
        cout << '\n';
    }
    return 0;
}
