// #pragma GCC optimize("O3,fast-math,unroll-loops")
#include <bits/stdc++.h>

#define i64 int64_t
#define vi vector<int>
#define vvi vector<vi>
#define vc vector
#define vb vc<bool>
#define pb push_back
#define pii pair<int, int>
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

using namespace std;

template <typename T>

istream& operator>>(istream& in, vector<T> &a) {
    for (T &el : a) in >> el;
    return in;
}

template <typename T>

ostream& operator<<(ostream& out, vector<T> a) {
    for (T &el : a) out << el << " ";
    return out;
}


void solve() {
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vi a(n);
    cin >> a;
    string s;
    cin >> s;
    vi cnt(2);
    for (int i = 0; i < n; ++i) ++cnt[(i + a[i]) % 2];
    string ans1 = (abs(cnt[0] - cnt[1]) == n % 2 ? "Yes" : "No");
    if (ans1 == "No") {
        cout << ans1;
        return;
    }
    cout << "Yes\n";
    if (T == 1) return;
    vc<pair<i64, i64>> ans;
    if (a[0] > a[1]) swap(a[0], a[1]);
    if (s == "RR") {
        assert(a[0] != a[1]);
        int x = (2 * m + a[0] - a[1]) / 2;
        ans.pb({x - a[0], x});
    } else if (s == "LL") {
        assert(a[0] != a[1]);
        int x = (2 + a[1] - a[0]) / 2;
        ans.pb({m - x + 1, a[1] - x + m - 1});
    } else if (s == "RL") {
        int x = (a[0] + a[1]) / 2;
        if (x <= (m) / 2) {
            ans.pb({m - x + 1, a[1] - x + m - 1});
        } else {
            ans.pb({x, a[1] - x});
        }
    } else {
        int x = (2 * m - a[1] + a[0] + 2) / 2;
        if (x <= (m) / 2) {
            ans.pb({m - x + 1, m - a[1] + m - 1 - x + m});
        } else {
            ans.pb({x, m - a[1] + m - x});
        }
    }
    if (T == 2) {
        cout << ans[0].fi;
        return;
    } else {
        cout << ans[0].fi << '\n';
        cout << ans.size() << '\n';
        cout << ans[0].se << " " << ans[0].fi << '\n';
    }
}

int32_t main() {
    // freopen("inputa.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
}