#ifdef ONPC
    #define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

#define all(v) begin(v), end(v)

using ll = long long;

const ll INF = 1e18L + 10;

void next(vector<int> &a, string &s, int m) {
    for (int i = 0; i < a.size(); ++i) {
        if (s[i] == 'L') {
            a[i]--;
            if (a[i] == 0) {
                s[i] = 'R';
            }
        } else {
            a[i]++;
            if (a[i] == m - 1) {
                s[i] = 'L';
            }
        }
    }
};

int brute(vector<int> a, string s, int t, int m) {
    int res = -1;
    if (t >= 2 * m) { return res; }
    int mx = *max_element(all(a)), mn = *min_element(all(a));
    if (mn == mx && *max_element(all(s)) == *min_element(all(s))) {
        return m;
    }

    auto old_a = a;
    auto old_s = s;
    for (int i = m - 1; i > mx; --i) {
        for (int j = 0; j < a.size(); ++j) {
            if (a[j] == i - 1) {
                s[j] = 'L';
            }
        }

        next(a, s, i);
        res = max(res, brute(a, s, 1, i));

        a = old_a;
        s = old_s;
    }

    next(a, s, m);
    res = max(res, brute(a, s, t + 1, m));

    return res;
}

void test_case() {
    int t, n, m;
    cin >> t >> n >> m;
    vector<int> a(n);
    for (auto &i : a) {
        cin >> i; i--;
    }
    string s;
    cin >> s;

    for (int i = 0; i < n; ++i) {
        if (s[i] == 'L') {
            if (a[i] == 0) {
                s[i] = 'R';
            }
        } else {
            if (a[i] == m - 1) {
                s[i] = 'L';
            }
        }
    }



    assert(n == 2);
    pair<ll, ll> ans = {-INF, -INF};
    for (int i = 0; i <= 5e8; ++i, next(a, s, m)) {
        if (a[0] == a[1]) {
            ans = max(ans, make_pair<ll, ll>(a[0] + 1, i));
        }
    }

    if (ans.second != -INF) {
        cout << "Yes" << '\n';
        if (t >= 2) {
            cout << ans.first << '\n';
            if (t >= 3) {
                cout << format("1\n{} {}", ans.second, ans.first);
            }
        }
    } else {
        cout << "No" << '\n';
    }

//    int res = brute(a, s, 0, m);
//    if (res == -1) {
//        cout << "No" << '\n';
//    } else {
//        cout << "Yes" << '\n';
//        if (t >= 2) {
//            cout << res << '\n';
//        }
//    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
//    cin >> t;
    while (t--) {
        test_case();
    }

    return 0;
}
