#include <bits/stdc++.h>

using namespace std;

#define int int64_t

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    int n,m;
    cin >> n >> m;
    int a[n];
    bool c = 0,nc = 0;
    for(int i = 0;i < n;++i)
    {
        cin >> a[i];
        c |= (a[i]%2 == 0);
        nc |= (a[i]%2 == 1);
    }
    string s;
    cin >> s;
    set<pair<char,int>> gr;
    for(int i = 0;i < s.size();++i)
    {
        gr.insert({s[i],a[i]});
        if(a[i] == 1 && s[i] == 'L')
            s[i] = 'R';
        if(a[i] == m && s[i] == 'R')
            s[i] = 'L';
    }
    cout << ((!(c & nc)) ? "Yes\n" : "No\n");
    if(t >= 2 && (!(c & nc)))
    {
        vector<int> numbers;
        for(auto [a,b] : gr)
        {
            numbers.push_back((a == 'R' ? b-1 : m-b+m-1));
        }
        sort(numbers.begin(),numbers.end());
        vector<int> diff;
        for(int i = 0;i < numbers.size();++i)
        {
            int l = numbers[i];
            int r = numbers[(i+1) % numbers.size()];
            diff.push_back(min((r-l+(2*(m-1)))%(2*(m-1)),(l-r+(2*(m-1)))%(2*(m-1))));
        }
        int mxdiff = -1,ind = -1;
        for(int i = 0;i < diff.size();++i)
        {
            if(diff[i] > mxdiff)
            {
                mxdiff = diff[i];
                ind = i;
            }
        }
        int ld = numbers[ind];
        int rd = numbers[(ind+1)%numbers.size()];
        if((rd-ld+(2*(m-1)))%(2*(m-1)) > (ld-rd+(2*(m-1)))%(2*(m-1)))
        {
            swap(ld,rd);
        }
        int endpos = m - diff[ind]/2 - 1;
        int mvs = (endpos - ld + (2*(m-1))) % (2*(m-1));
        int ans = m;
        int u = 0;
        for(int i = 0;i < diff.size();++i)
        {
            if(diff[i])
            {
                u++;
            }
            ans -= diff[i] / 2;
        }
        u--;
        ans += diff[ind] / 2;
        cout << ans << "\n";
        if(t <= 2)
        {
            return 0;
        }
        if(ans == m)
        {
            cout << 0;
            return 0;
        }
        cout << u << "\n";
        int col = m;
        for(int i = ind-1+diff.size();i > ind;--i)
        {
            int k = i % diff.size();
            mvs += diff[k]/2 + diff[(k+1)%diff.size()]/2;
            col -= diff[k] / 2;
            cout << mvs << ' ' << col << "\n"; 
        }
    }
    return 0;
}