#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;

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

// gp_hash_table<ll, ll> ht;

ll get(ll pos, ll d, ll m, ll t) {
    t %= 2 * (m - 1);
    if (d == 0) {
        if (t <= pos - 1) {
            return pos - t;
        } else {
            return get(1, 1, m, t - pos + 1);
        }
    } else {
        if (t <= m - pos) {
            return pos + t;
        } else {
            return get(m, 0, m, t - m + pos);
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll t;
    cin >> t;
    
    ll n, m;
    cin >> n >> m;

    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }
    string s;
    cin >> s;

    for (ll i = 1; i < n; ++i) {
        if (a[i] % 2 != a[0] % 2) {
            cout << "NO" << '\n';
            return 0;
        }
    }

    cout << "YES" << '\n';
    if (t == 1) {
        return 0;
    }

    ll x;

    if (a[0] > a[1]) {
        swap(a[0], a[1]);
    }

    if (a[0] == a[1]) {
        x = a[0];
    } else if (a[0] < a[1] && s[0] == 'R' && s[1] == 'L') {
        x = (a[0] + a[1]) / 2;
    } else {
        if (s[0] == s[1] && s[0] == 'R') {
            ll t = m - a[1];
            ll p1 = get(a[0], 1, m, t);
            ll p2 = get(a[1], 1, m, t);
            x = (p1 + p2) / 2;
        } else if (s[0] == s[1] && s[0] == 'L') {
            ll t = a[0] - 1;
            ll p1 = get(a[0], 0, m, t);
            ll p2 = get(a[1], 0, m, t);
            x = (p1 + p2) / 2;
        } else {
            ll t = max(m - a[1], a[0] - 1);
            ll p1 = get(a[0], 0, m, t);
            ll p2 = get(a[1], 0, m, t);
            x = (p1 + p2) / 2;
        }
    }

    cout << max(x, m - x + 1) << '\n';
    
    if (t == 2) {
        return 0;
    }

    return 0;
}
