// ConsoleApplication4.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

struct sheep
{
    int pos;
    char dir;

    bool operator==(const sheep& oth) const = default;
    bool operator!=(const sheep& oth) const = default;
};

struct timepoint
{
    union
    {
        ll first;
        ll tm;
    };
    union
    {
        int second;
        int pos;
    };
};

// {time, position}
timepoint solve(sheep a, sheep b, int m)
{
    if (a.pos > b.pos)
    {
        swap(a, b);
    }
    if (a.pos == b.pos)
    {
        return { 0,a.pos };
    }
    int tm = 0;
    if (a.dir == 'L')
    {
        int t = (a.pos - 1);
        a.pos = 1;
        if (b.dir == 'R')
            b.pos += t;
        else
            b.pos -= t;
        tm += t;
        a.dir = 'R';
        if (b.pos >= m)
        {
            b.pos = 2 * m - b.pos;
            b.dir = 'L';
        }
    }
    if (b.dir == 'R')
    {
        int t = (m - b.pos);
        a.pos += t;
        b.pos += t;
        b.dir = 'L';
        tm += t;
    }
    return { tm + (b.pos - a.pos) / 2,(a.pos + b.pos) / 2 };
}

timepoint solve2(sheep a, sheep b, int m)
{
    auto t = solve(a, b, m);
    if (t.first == 0 && a.dir == b.dir)
        t.second = m;
    return t;
}

timepoint solve3(sheep a, sheep b, int m)
{
    auto t = solve2(a, b, m);
    int t2 = m + 1 - t.second;
    if (t2 > t.second)
    {
        t.second = t2;
        t.first += (m - 1ll);
        // assert(false);
    }
    return t;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    // assert(t == 1);
    int n, m;
    cin >> n >> m;
    vector <int> a(n);
    for (auto& i : a)
    {
        cin >> i;
    }
    string s;
    cin >> s;
    int k = a[0] & 1;
    for (auto& i : a)
    {
        if ((i & 1) != k)
        {
            puts("No");
            return 0;
        }
    }
    cout << "Yes\n";
    if (t > 1)
    {
        assert(n == 2);
        vector <sheep> lst;
        for (size_t i = 0; i < n; i++)
        {
            lst.push_back(sheep{ a[i],s[i] });
        }
        auto tmp = solve3(lst[0], lst[1], m);
        cout << tmp.pos << '\n';
        // assert(tmp.first > 0);
        if (t > 2)
        {
            if (tmp.pos != m)
                cout << "1\n" << tmp.first << ' ' << tmp.second << '\n';
            else
                cout << "0\n";
        }
    }
    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
