#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#endif
#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;

using ll = long long;
using u64 = unsigned long long;
using u32 = unsigned int;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, long long>;
using pli = pair<long long, int>;
using pll = pair<long long, long long>;
template <typename T>
using uset = unordered_set<T>;
template <typename T1, typename T2>
using umap = unordered_map<T1, T2>;

template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#ifndef _DEBUG
#pragma GCC optimize("O3,unroll-loops,fast-math")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif

ll m;

pll intersect(ll x, char dx, ll y, char dy) {
    if (x == y)
        return {0, x};
    if (x > y) {
        swap(x, y);
        swap(dx, dy);
    }
    ll t = 0;
    if (dx == dy) {
        if (dx == 'L') {
            t += x - 1;
            y -= x - 1;
            x = 1;
            dx = 'R';
        } else {
            t += m - y;
            x += m - y;
            y = m;
            dy = 'L';
        }
    } else if (dx == 'L') {
        ll min_time = min(x - 1, m - y);
        x -= min_time;
        y += min_time;
        dx = 'R';
        if (y == m)
            dy = 'L';
        pll res = intersect(x, dx, y, dy);
        res.first += min_time;
        return res;
    }
    return {t + (y - x) / 2, (x + y) / 2};
}

inline void solve() {
    int info;
    cin >> info;
    int n;
    cin >> n >> m;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    string s;
    cin >> s;
    {
        set<ll> parities;
        for (int i = 0; i < n; i++)
            parities.insert(a[i] & 1);
        if (parities.size() == 2) {
            cout << "NO\n";
            return;
        }
    }
    cout << "YES\n";
    {
        bool all_eq = true;
        for (int i = 1; i < n; i++)
            if (a[i] != a[i - 1])
                all_eq = false;
        for (int i = 1; i < n; i++)
            if (s[i] != s[i - 1])
                all_eq = false;
        if (all_eq) {
            if (info >= 2)
                cout << m << '\n';
            if (info == 3)
                cout << 0 << '\n';
            return;
        }
    }
    auto [t, x] = intersect(a[0], s[0], a[1],s[1]);
    if (x < m + 1 - x) {
        t += m;
        x = m + 1 - x;
    }
    if (info >= 2)
        cout << x << '\n';
    if (info == 3) {
        cout << 1 << '\n';
        cout << t << ' ' << x << '\n';
    }
}

signed main() {
#ifdef _DEBUG
    freopen("01.dat", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int tt = 1;
#ifdef _DEBUG
    cin >> tt;
#endif
    for (int test_id = 1; test_id <= tt; test_id++) {
#ifdef _DEBUG
        cout << "Case #" << test_id << ":\n";
#endif
        solve();
    }
    return 0;
}
