#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <iomanip>

using namespace std;

int main()
{
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int T, n, m;
    cin >> T >> n >> m;
    vector <int64_t> d(n);
    vector <int64_t> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    for (int i = 0; i < n; ++i) {
        char c;
        cin >> c;
        if (c == 'L') d[i] = -1;
        if (c == 'R') d[i] = 1;
    }

    vector <pair <int64_t, int>> t;
    for (int i = 0; i < n; ++i) {
        if (d[i] == 1) {
            t.push_back({m - x[i], i});
            t.push_back({m - x[i] + m - 1, i});
            t.push_back({m - x[i] + 2 * (m - 1), i});
        } else {
            t.push_back({x[i] - 1, i});
            t.push_back({x[i] - 1 + m - 1, i});
            t.push_back({x[i] - 1 + 2 * (m - 1), i});
        }
    }
    sort(t.begin(), t.end());
    int ans = -1;
    int tm = 0;
    for (int i = 0; i < n; ++i) {
        int l = 0;
        if (i > 0) {
            l = t[i - 1].first;
        }
        if (d[0] != d[1]) {
            if ((x[0] - x[1]) % 2 == 0) {
                int64_t k = (x[0] - x[1]) / (d[1] - d[0]);
                bool t1 = (k >= 0);
                bool t2 = (k + l <= t[i].first);
                if (t1 && t2) {
                    int y = x[0] + d[0] * k;
                    if (y > ans) {
                        tm = k + l;
                        ans = y;
                    }
                }
            }
        } else if (x[0] == x[1]) {
            ans = m;
            tm = -1;
        }
        int64_t k = t[i].second;
        if (d[k] == -1) {
            x[k] = 1;
        } else {
            x[k] = m;
        }
        x[k ^ 1] += (t[i].first - l) * d[k ^ 1];
        d[k] *= -1;
    }

    if (ans == -1) {
        cout << "NO";
    } else {
        cout << "YES\n";
        if (T > 1) {
            cout << ans << "\n";
        }
        if (T > 2) {
            if (tm == -1) cout << "0\n";
            else {
                cout << "1\n";
                cout << tm << " " << ans << "\n";
            }
        }
    }
    return 0;
}
