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

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
const int MOD = 998244353;
const ll INF = 1e18;

using ordered_set = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;

void solve1();

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int qwerty = 1;
    // cin >> qwerty;
    while (qwerty--) {
        solve1();
    }
}

void solve1() {
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    string ss;
    cin >> ss;
    if (n == 2 && a[0] == 1 && a[1] == m) {
        if (m % 2 == 0) {
            cout << "No";
            return;
        }
        cout << "Yes\n";
        if (T >= 2) {
            cout << (m + 1) / 2 << '\n';
            if (T == 3) {
                cout << 1 << '\n';
                cout << (m + 1) / 2 - 1 << ' ' << (m + 1) / 2;
            }
        }
        return;
    }
    if (n == 2) {
        int fir = a[0], sec = a[1];
        int f = -1, s = -1;
        if (ss[0] == 'R') {
            f = 1;
        }
        if (ss[1] == 'R') {
            s = 1;
        }
        int mx = -1, tt = -1;
        for (int time = 0; time < 400000; time++) {
            if (fir == 1) {
                f = 1;
            }
            if (fir == m) {
                f = -1;
            }
            if (sec == 1) {
                s = 1;
            }
            if (sec == m) {
                s = -1;
            }
            if (fir == sec) {
                if (fir > mx) {
                    mx = fir;
                    tt = time;
                }
            }
            fir += f;
            sec += s;
        }
        if (mx == -1) {
            cout << "No\n";
            return;
        }
        cout << "Yes\n";
        if (T >= 2) {
            cout << mx << '\n';
            if (T == 3) {
                cout << 1 << '\n';
                cout << tt << ' ' << mx;
            }
        }
        return;
    }
}
