#include <bits/stdc++.h>

#define all(v) v.begin(), v.end()
#define len(v) (int)v.size()

using namespace std;
using ll = long long;
using ld = long double;

ll f(ll m, ll pos0, ll pos1)
{
    if (pos0 == pos1)
    {
        return m;
    }
    ll op0 = pos0, op1 = pos1;
    ll md = 2 * m - 2;
    pos1 = (op1 - op0 + md) % md;
    ll i = (md - pos1) / 2;
    pos0 = (op0 - op1 + md) % md;
    ll i1 = (md - pos0) / 2;
    if (i >= i1)
    {
        return i + 1;
    }
    return i1 + 1;
}

void solve()
{
    ll t, n, m;
    cin >> t >> n >> m;
    vector<ll> a(n);
    string s;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        --a[i];
    }
    cin >> s;
    int cnt0 = 0, cnt1 = 0;
    for (int i = 0; i < n; ++i)
    {
        ll pos = a[i];
        if (s[i] == 'L')
        {
            pos = (m - 1 - a[i]) + m - 1;
        }
        if (pos % 2 == 0)
        {
            ++cnt0;
        } else
        {
            ++cnt1;
        }
    }
    if (cnt0 != 0 && cnt1 != 0)
    {
        cout << "No";
        return;
    }
    cout << "Yes\n";
    if (t == 1) return;
    vector<ll> pos(n);
    for (int i = 0; i < n; ++i)
    {
        pos[i] = a[i];
        if (s[i] == 'L')
        {
            pos[i] = (m - 1 - a[i]) + m - 1;
        }
    }
    sort(all(pos));
    auto nps = pos;
    pos = {nps[0]};
    for (int i = 1; i < n; ++i)
    {
        if (pos.back() != nps[i])
        {
            pos.push_back(nps[i]);
        }
    }
    n = len(pos);
    if (n == 1)
    {
        cout << m << '\n';
        return;
    }
    if (n == 2)
    {
        cout << f(m, pos[0], pos[1]) << '\n';
        return;
    }
    ll mn = -1;
    vector<int> ord = {0, 1, 2};
    ll md = 2 * m - 2;
    for (int ep = 0; ep < 6; ++ep)
    {
        ll otn = (pos[ord[1]] - pos[ord[0]] + md) % md;
        ll i = (md - otn) / 2;
        ll t = (md - pos[ord[0]]) % md + i;
        ll nps = (pos[ord[2]] + t) % md;
        if (nps > i && nps < md - i)
        {
            next_permutation(all(ord));
            continue;
        }
        if (nps > i)
        {
            nps += 2 * i - md;
        }
        //cout << ord[0] << ' ' << ord[1] << ' ' << nps << ' ' << i << ' ' << f(i + 1, i, nps) << '\n';
        mn = max(mn, f(i + 1, i, nps));

        next_permutation(all(ord));
    }
    cout << mn << '\n';
    if (t == 2) return;
    return;

    /*if (m % 2 == 0)
    {
        cout << "No";
        return;
    }
    cout << "Yes\n";
    if (t == 1) return;
    cout << (m + 1) / 2 << "\n";
    if (t == 2) return;
    cout << "1\n";
    cout << m / 2 << ' ' << (m + 1) / 2;*/
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);

    //cin >> t;

    while (t--)
    {
        solve();
        cout << '\n';
    }
    return 0;
}
