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

#define int long long
#define pb push_back
#define endl "\n"
using ll = long long;
using pii = pair<int, int>;
using ld = long double;

template <typename t>
istream& operator>>(istream &in, vector<t> &a){
    for (auto &el : a){
        in >> el;
    }
    return in;
}

template <typename t>
ostream& operator<<(ostream &out, vector<t> &a){
    for (auto &el : a){
        out << el << " ";
    }
    return out;
}



void solve(){
    int _t;
    cin >> _t;
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<int> a(n);
    int now = 0;
    for (int i = 0; i < n; ++i){
        cin >> a[i]; a[i]--;
        if (i == 0) now = a[i] % 2;
        if (now != a[i] % 2){
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
    if (_t == 1){
        return;
    }
    vector<int> side(n);
    for (int i = 0; i < n; ++i){
        char c;
        cin >> c;
        if (c == 'L') side[i] = -1;
        else side[i] = 1;
    }
    if (n == 2 && a[0] == 0 && a[1] == m - 1){
        cout << m / 2 + 1 << endl;
        if (_t == 3){
            cout << 1 << endl;
            cout << m / 2 << " " << m / 2 + 1 << endl;
        }
        return;
    }
    auto move = [&] (int i, int k){
        if (side[i] == 1){
            // if ()
        }
    };
    if (a[0] == a[1] && side[0] == side[1]){
        cout << m << endl;
        cout << 0 << endl;
        return;
    }
    int t = 0;
    while (a[0] != a[1] || a[0] < m / 2){
        if (a[0] == 0) side[0] = 1;
        if (a[1] == m - 1) side[1] = -1;
        if (a[0] == m - 1) side[0] = -1;
        if (a[1] == 0) side[1] = 1;
        t++;
        a[0] += side[0];
        a[1] += side[1];
    }
    int cnt = a[0];
    if (cnt >= m / 2){
        cout << cnt + 1 << endl;
        if (_t == 2) return;
        cout << 1 << endl;
        cout << t << " " << cnt + 1 << endl;
    } else{
        assert(0);
        t += m;
        cnt = m - cnt - 1;
        cout << cnt + 1 << endl;
        if (_t == 2) return;
        cout << 1 << endl;
        cout << t << " " << cnt + 1 << endl;
    }
}



signed main(){
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}   