#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cassert>
#include <ctime>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

// #pragma GCC optimize("Ofast")
// #pragma ivdep

using namespace std;
using ll = long long;
using ld = long double;
using lll = __int128;
using pii = pair<int, int>;
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    ll t; cin >> t;
    ll n, m; cin >> n >> m;
    ll a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    string s; cin >> s;
    if (abs(a[0] - a[1]) % 2 == 1) {
        cout << "No\n";
        return;
    }
    cout << "Yes\n";
    // if (t >= 2)
    //     cout << m / 2 + 1 << '\n';
    // if (t == 3)
    //     cout << "1\n" << m / 2 + m - 1 << ' ' << m / 2 + 1 << '\n';

    // return;

    ll aw, aq;
    if (s[0] == s[1]) {
        aw = m - abs(a[0] - a[1]) / 2;
        if (s[0] == 'L') {
            ll ma = min(a[0], a[1]);
            aq = ma - 1 + m - 1 + m - aw;

        } else {
            ll ma = max(a[0], a[1]);
            aq = m - ma + m - aw;
        }
    } else {
        if (s[0] == 'R') {
            swap(a[0], a[1]);
        }
        ll mt = min(a[0] - 1, m - a[1]);
        a[0] -= mt;
        a[1] += mt;
        aw = m - abs(a[0] - a[1]) / 2;
        if (s[0] == 'L') {
            ll ma = min(a[0], a[1]);
            aq = ma - 1 + m - 1 + m - aw;

        } else {
            ll ma = max(a[0], a[1]);
            aq = m - ma + m - aw;
        }
        aq += mt;
    }
    if (t >= 2)
        cout << aw << "\n";
    if (t == 3)
        cout << "1\n" << aq << ' ' << aw << '\n';
}

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int _ = 1;
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        cin >> _;
    #endif

    while (_--) {
        solve();
        cout << '\n';
    }

    return 0;
}
