#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;

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";
    ll md = 2 * m - 2;
    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);
    ll mn = m - 1;
    ll curm = m;
    vector<int> ban(n, 0);
    for (int e = 1; e < n; ++e)
    {
        ll md = 2 * curm - 2;
        ll mx = -1;
        int mxi = -1;
        for (int j = 1; j < n; ++j)
        {
            if (ban[j]) continue;
            if (mx < (md - (pos[j] - pos[0])) / 2)
            {
                mx = (md - (pos[j] - pos[0])) / 2;
                mxi = j;
            }
        }
        ll i = mx;
        ban[mxi] = 1;
        curm = i + 1;
        ll t = (md - pos[0]) % md + i;
        for (int j = 0; j < n; ++j)
        {
            pos[j] = (pos[j] + t) % md;
            if (pos[j] > i)
            {
                pos[j] -= 2 * (mn - i);
            }
        }
        mn = i + 1;
    }
    cout << mn + 1 << '\n';
    if (t == 2) return;
    return;
    ll i = (md - (a[n - 1] - a[0])) / 2;
    cout << i + 1 << '\n';
    if (t == 2) return;
    vector<pair<int, int>> ans;
    int lt = m + 100;
    for (int i = n - 2; i >= 0; --i)
    {
        ll ci = (md - (a[n - 1] - a[i])) / 2;
        if (ci < lt)
        {
            lt = ci;
            ans.push_back({ci - a[i], ci + 1});
        }
    }
    cout << len(ans) << '\n';
    for (auto p : ans)
    {
        cout << p.first << ' ' << p.second << '\n';
    }


    /*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;
}
