#include "bits/stdc++.h"

using namespace std;

#ifdef OG_Matveychick1
bool local = 1;
#else
bool local = 0;
#endif


#define ret return
#define con continue
#define be(x) x.begin()
#define en(x) x.end()
#define all(x) be(x), en(x)
#define pb push_back
#define fi first
#define se second
#define ba(x) x.back()
#define pob pop_back
#define for0(i, n) for (ll i = 0; i < n; i++)
#define rfor0(i, n) for (ll i = n - 1; i >= 0; i--)
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define for1(i, n) for (ll i = 1; i < n; i++)
#define rfor1(i, n) for (ll i = n - 1; i >= 1; i--)
#define sz(x) (ll) x.size()
#define rev reverse
#define rs resize
#define endl '\n'
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define rsun(x) x.rs(unique(all(x)) - be(x))
#define ins insert
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef string str;
typedef set<ll> sll;
typedef vector<vector<ll> > vvll;
typedef set<pll> spll;
typedef vector<char> vc;
typedef vector<vector<char> > vvc;
typedef vector<str> vs;
typedef queue<ll> qll;

mt19937_64 rn(chrono::steady_clock::now().time_since_epoch().count());

ll rnd(ll l, ll r) {
    ret rn() % (r - l + 1) + l;
}

void solve();

signed main(int argc, char *argv[]) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    cout << fixed;
    if (local) {
        freopen("input.txt", "r", stdin);
    }
    ll t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}



ll get(ll p, ll np, ll m, ll v) {
    v %= 2 * (m - 1);
    if (np == 'L') {
        if (v > p) {
            if (v > p + m - 1) {
                ret m - 1 - (v - (p + m - 1));
            }
            ret v - p;
        }
        else ret p - v;
    } else {
        if (v > m - 1 - p) {
            if (v > m - 1 - p + m - 1) {
                ret v - (m - 1 - p + m - 1);
            }
            ret m - 1 - (v - (m - 1 - p));
        }
        else ret p + v;
    }
}

void solve() {
    ll T;
    cin >> T;
    ll n, m;
    cin >> n >> m;
    vll a(n);
    str s;
    for0(i, n) cin >> a[i], a[i]--;
    cin >> s;
    ll c = a[0] % 2;
    for1(i, n) {
        if (a[i] % 2 != c) {
            cout << "No";
            ret;
        }
    }
    cout << "Yes" << endl;
    ll ans, tm;
    if (a[0] > a[1]) swap(a[0], a[1]), swap(s[0], s[1]);
    if (s[0] == 'R') {
        if (s[1] == 'L') {
            ans = (a[1] + a[0]) / 2;
        } else {
            ans = a[0] + ((m - a[1] - 1) + (m - 1 - a[0])) / 2;
        }
    } else {
        if (s[1] == 'L') {
            ans = a[1] - ((a[0]) + (a[1])) / 2;
        } else {
            ll d = a[0] + (m - 1 - a[1]) + (m - 1);
            d /= 2;
            ans = (d - a[0]);
        }
    }
    ans = max(ans, m - 1 - ans);
    if (s[0] == 'L') {
        if (ans < a[0]) {
            tm = a[0] - ans;
        } else {
            tm = a[0] + ans;
        }
    } else {
        if (ans > a[0]) {
            tm = ans - a[0];
        } else {
            tm = (m - 1 - a[0]) + (m - 1 - ans);
        }
    }
    if (get(a[1], s[1], m, tm) != ans) {
        char np;
        if (s[0] == 'L') {
            if (tm > a[0]) np = 'R';
            else np = 'L';
        } else {
            if (tm > m - 1 - a[0]) np = 'L';
            else np = 'R';
        }
        if (np == 'L') tm += 2 * ans;
        else tm += 2 * (m - 1 - ans);
    }
    assert(get(a[0], s[0], m, tm) == ans);
    assert(get(a[1], s[1], m, tm) == ans);
    if (T > 1) {
        cout << ans + 1 << endl;
    }
    if (T > 2) {
        cout << 1 << endl;
        cout << tm << ' ' << ans + 1 << endl;
    }
}
