#include<bits/stdc++.h>
#define int long long
using namespace std;

const int INF = 1e18;

map<int, int> mp;


bool check(string& s, vector<int>& el) {
    for (int i = 1; i < (int)s.size(); i++) {
        if (s[i] != s[0]) {
            return false;
        }
    }
    for (auto u : el) {
        if (u != el[0]) {
            return false;
        }
    }
    return true;
}




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


signed main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    vector<int> tt(2);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        tt[a[i] & 1]++;
    }
    string s;
    cin >> s;
    if (!tt[0] || !tt[1]) {
        cout << "Yes\n";
        if (t == 1) {
            exit(0);
        }
        if (check(s, a)) {
            cout << m << '\n';
            // exit(0);
            if (t == 3) {
                cout << 0 << '\n';
            }
            exit(0);
        }
        int mom = 0;
        while (a[0] != a[1]) {
            mv(a, s, m);
            mom++;
        }
        int T = max(a[0], m + 1 - a[0]);
        // cout << T << '\n';
        if (t == 2) {
            exit(0);
        } 
        while (a[1] != T || a[0] != T) {
            mom++;
            mv(a, s, m);
        }
        // if (a[1] != T) assert(false);
        cout << 1 << '\n' << mom << ' ' << T << '\n';
        
    } else {
        cout << "No\n";
    }
}
