#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    assert(n == 2);
    vector<int> a(n);
    for (auto& i : a) cin >> i;
    string s;
    cin >> s;
    {
        if (m % 2) {
            cout << "Yes\n";
            if (t >= 2) {
                cout << (m+1)/2 << '\n';
            }
            if (t >= 3) {
                cout << 1 << '\n';
                cout << m/2 << ' ' << (m+1)/2 << '\n';
            }
        } else {
            cout << "No\n";
        }
    }
    if (a[0] % 2 != a[1] % 2) {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    for (int ti = 0; ti <= 4 * m; ti++) {
        assert(ti <= m);
        for (int i = 0; i < n; i++) {
            if (a[i] == 1) {
                s[i] = 'R';
            }
            if (a[i] == m) {
                s[i] = 'L';
            }
        }
        bool check = true;
        for (int i = 0; i < n; i++) {
            check &= a[0] == a[i];
        }
        if (check) {
            if (t >= 2) {
                cout << a[0] << '\n';
            }
            if (t >= 3) {
                cout << 1 << '\n';
                cout << ti << ' ' << a[0] << '\n';
            }
            return 0;
        }
        for (int i = 0; i < n; i++) {
            if (s[i] == 'L') a[i]--;
            else a[i]++;
        }
    }
    assert(0);
}
