/**
 low cortisol default code
*/


#include <iostream>
#include <algorithm>
#include <vector>

#define maxn 500005
#define maxlog 21
#define PB push_back
#define X first
#define Y second
#define control std::cout<<"passed"<<"\n";


typedef long long ll;
typedef long double ld;
typedef std::pair <int , int> pii;
typedef std::pair <ll , ll> pll;

const ll inf = 1e9;


int a[maxn];

int getu(int x , int m)
{
    if (x <= m - 2)
        return x + 1;
    return 2 * (m - 1) - x + 1;
}

void read()
{
    int t , n , m;
    std::cin >> t >> n >> m;

    std::string s;

    for (int i = 0; i < n; i++)
        std::cin >> a[i];
    std::cin >> s;

    for (int i = 1; i < n; i++)
        if (a[i] % 2 != a[i - 1] % 2)
        {
            std::cout << "No" << "\n";
            return;
        }

    std::cout << "Yes" << "\n";

    if (t == 1)
        return;

    int c0 , c1;
    if (s[0] == 'R')
        c0 = a[0] - 1;
    else
        c0 = 2 * (m - 1) - (a[0] - 1);

    if (s[1] == 'R')
        c1 = a[1] - 1;
    else
        c1 = 2 * (m - 1) - (a[1] - 1);


    if (c0 == c1)
    {
        std::cout << 2 * (m - 1) << "\n";
        if (t == 2)
            return;
        std::cout << 0 << "\n";
        return;
    }

    int dd = ((c0 - c1) / 2 % (m - 1) + m - 1) % (m - 1);
    int ans = std::max(getu(dd , m) , m + 1 - getu(dd , m));

    std::cout << ans << "\n";
    if (t == 2)
        return;

    int tt = (-(c0 + c1) / 2 % (m - 1) + (m - 1)) % (m - 1);
    int pom = getu((c0 + tt) % (2 * (m - 1)), m);

    ll ret;
    if (pom == ans)
        ret = tt;
    else
        ret = tt + (m - 1);

    std::cout << 1 << "\n";
    std::cout << ret << " " << ans << "\n";
}




int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int tests = 1;
    //std::cin >> tests;

    while (tests--)
    {
        read();
    }

    return 0;
}