#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1e18 + 7;
int main() {
    cin.tie(0)->sync_with_stdio(0);
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int>a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    string s;
    cin >> s;
    int cnt = 0;
    for (auto x : a) {
        cnt += x & 1;
    }
    if (cnt != 0 && cnt != n) {
        cout <<"No\n";
        return 0;
    }
    cout <<"Yes\n";
    if (a[0] == a[1] && s[0] == s[1]) {
        cout <<m<<"\n0\n";
        return 0;
    }
    int x = a[0], y = a[1];
    int c, d;
    if (s[0] == 'L') c = 0;
    else c = 1;
    if (s[1] == 'R') d = 0;
    else d = 1;
    int lft = m, rgt = 0;
    for (int i = 0; i < 10000; ++i) {
        if (x < y && c == 1 && d == 0 || x > y && c == 0 && d == 1) {
            int pos = (x + y) / 2;
            lft = max(lft, pos);
            rgt = min(rgt, pos);
            if (c == 1) {
                x = pos + 1;
                y = pos - 1;
            }
            else {
                x = pos - 1;
                y = pos + 1;
            }
            if (x == m + 1) {x = m - 1; c = 0;}
            if (y == 0){y = 2; d = 1;}
            if (y == m + 1) {y = m - 1; d = 0;}
            if (x == 0){x = 2; c = 1;}
        }


        if (c == d && c == 1) {
            int t = min(m - y, m - x);
            y = t + y;
            x = t + x;
            if (x == m){ --x;c = 0;}
            else ++x;
            if (y == m) {--y; d = 0;}
            else ++y;
        }
        if (c == d && c == 0) {
            int t = min(y - 1,  x - 1);
            y = -t + y;
            x = -t + x;
            if (x == 1){ ++x;c = 1;}
            else --x;
            if (y == 1) {++y; d = 1;}
            else --y;
        }
    }

    cout <<max(rgt, m - lft + 1)<<"\n0\n";

}