#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,bmi2")
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    int n;
    cin >> n;
    int m;
    cin >> m;
    int a[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    char c[n + 1];
    for (int j = 1; j <= n; j++) {
        cin >> c[j];
    }
    if (a[1] % 2 != a[2] % 2) {
        cout << "No\n";
        exit(0);
    } else {
        cout << "Yes\n";
    }
    if (t == 1) {
        int mt = (a[1] + a[2]) / 2;
        cout << mt << endl;
        if (t == 2) {
            exit(0);
        }
        cout << 1 << endl;
        cout << 0 << ' ' << a[1] << endl;
        exit(0);
    }
    if (a[1] > a[2]) {
        swap(a[1], a[2]);
        swap(c[1], c[2]);
    }
    if (a[1] == a[2]) {
        exit(0);
    }
    int st = 0;
    if (c[1] == 'L' && c[2] == 'R') {
        st = max(a[1] - 1, m - a[2]);
        int f = st - (a[1] - 1);
        int s = st - (m - a[2]);
        a[1] = 1;
        a[1] += f;
        a[2] = m;
        a[2] -= s;
    }
    int mt = (a[1] + a[2]) / 2;
    cout << mt << endl;
    if (t == 2) {
        exit(0);
    }
    cout << 1 << endl;
    cout << mt - a[1] + st << ' ' << mt << endl;
    
    
}