#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

void fast_in_out() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(18) << fixed;
#ifdef LOCAL
    freopen("input.txt", "r",stdin);
    freopen("output.txt", "w",stdout);
#endif
}

typedef tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define all(x) (x).begin(), (x).end()
#define int long long
using ll = long long;
const int N = 2e5;
int n, m, T;
pair<int, int> vec[N];

void solve() {
    cin >> T >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> vec[i].first;
        --vec[i].first;
    }
    string s;
    cin >> s;
    for (int i = 0; i < n; ++i) {
        vec[i].second = s[i] == 'L' ? -1 : 1;
    }
    if (T == 1) {
        vector<int> ok(2);
        for (int i = 0; i < n; ++i) {
            ok[vec[i].first % 2]++;
        }
        if (ok[0] >= 1 && ok[1] >= 1) {
            cout << "No";
        } else {
            cout << "Yes";
        }
        return;
    }

    if (vec[0] == vec[1]) {
        cout << "Yes\n";
        cout << m << '\n';
        if (T == 2) {
            return;
        }
        cout << 0 << '\n';
    }
    if (vec[0].first % 2 == vec[1].first % 2) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
        return;
    }
    vector<pair<int, int> > p;
    int t = 0;
    while (true) {
        if (vec[0].first > vec[1].first) {
            swap(vec[0], vec[1]);
        }

        int t1 = m;
        for (int i = 0; i < 2; ++i) {
            if (vec[i].second == 1) {
                t1 = min(t1, m - 1 - vec[i].first);
            } else {
                t1 = min(t1, vec[i].first);
            }
        }

        if (vec[0].second == 1 && vec[1].second == -1 && vec[0].first != vec[1].first) {
            t1 = (vec[0].first + vec[1].first) / 2 - vec[0].first;
        }

        for (int i = 0; i < 2; ++i) {
            vec[i].first += t1 * vec[i].second;
            if (vec[i].first == 0) {
                vec[i].second = 1;
            }
            if (vec[i].first == m - 1) {
                vec[i].second = -1;
            }
        }
        t += t1;
        if (vec[0].first == vec[1].first) {
            p.emplace_back(vec[0].first, t);
        }
        if ((int) p.size() == 2) {
            break;
        }
    }
    sort(all(p));
    cout << p[1].first + 1 << '\n';
    if (T == 2) {
        return;
    }
    cout << "1\n";
    cout << p[1].second << ' ' << p[1].first + 1;
}

signed main() {
    fast_in_out();
    int qwe = 1;
    // cin >> qwe;
    while (qwe--) {
        solve();
    }
}
