#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define int ll

void solve() {
    int t; cin >> t;
    int n,m ; cin >> n >> m;
    vector<int> a(n);
    for (auto &u : a) cin >> u;

    string s; cin >> s;
    for (int j = 1; j < n; j++) {
        if(a[j]%2 != a[0]%2) {
            cout << "No\n";
            return;
        }
    }
    auto midpoint = [&](int x, int y)  {
        if (s[x] == s[y]) {
            int pt = abs(a[x] - a[y]) / 2;
            return m - pt;
        }
        if (a[x] > a[y]) swap(x, y);
        if (s[x] == 'R') {
            int pt= (a[x] + a[y]) / 2;
            return max(pt, m + 1 - pt);
        }
        int cl = min(a[x] - 1, m - a[y]);
        int pt1 = a[x] - cl, pt2 = a[y] + cl;
        // cout << pt1<<' ' <<pt2<<endl;
        int kek = (pt2 - pt1) / 2;
        return m - kek;
    };  
    auto where = [&](int x, int y) {
        int dir = (s[x] == 'L' ? 0 : 1), ps = a[x];
        while (true) {
            if (dir == 0) {
                if (ps - 1 >= y) return ps - y;

                y -= (ps - 1);
                ps = 1;
                dir = 1;
            } else {    
                if (m - ps >= y) return ps + y;
                y -= (m - ps);
                ps = m;
                dir = 0;
            }
        }
    };
    auto tim = [&](int x, int y) {
        int spent = 0, pos = a[x], dir = (s[x] == 'L' ? 0 : 1);
        vector<int> times;
        for (int it = 0; it < 10; it++){
            if (dir == 0) {
                if (pos>=  y) times.pb(spent+pos-y);
                spent += pos - 1;
                pos = 1;
                dir = 1;
            } else {
                if (pos <= y) times.pb(spent + y - pos);
                spent += m - pos;
                pos = m;
                dir = 0;
            }
        }
        return times;
    };
    cout<< "Yes\n";
    if (t == 1) return;
    cout << midpoint(0, 1) << endl;
    assert(midpoint(0, 1) == (m+1)/2);
    if(t==2) return; 
    cout << 1 << endl;
    int P = midpoint(0, 1);
    auto T1 = tim(0, P), T2 = tim(1, P);
    bool pr = 0;
    for(int el :T1) {
        for(int el2 : T2) {
            if(el == el2) {
                assert(el == m / 2);
                cout << el << endl;
                return;
            }
        }
    }
    assert(false);
    
    // vector<array<int, 3>> edges;
    // for (int i = 0; i < n; i++) {
    //     for (int j = i + 1; j < n; j++)edges.pb({midpoint(i, j), i, j});
    // }
    // sort(all(edges)); reverse(all(edges));
    // vector<int> par(n), siz(n, 1); iota(all(par), 0);
    // auto get = [&](int v) {
    //     while (par[v] != v){
    //         v = par[v] = par[par[v]];
    //     }
    //     return v;
    // };
    // auto merge = [&](int u, int v) -> bool {
    //     u = get(u); v = get(v);
    //     if (u == v) return false;
    //     if (siz[u] < siz[v]) swap(u, v);
    //     par[v] = u;
    //     siz[u] += siz[v];
    //     return true;
    // };

    // int cmp = n;
    // for(auto [w, i, j] : edges) {
    //     cmp -= merge(i, j);
    //     if (cmp == 1) {
    //         cout << w << '\n';;
    //         break;
    //     }
    // }
}

signed main() {
    int t = 1;
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        cin >> t;
    #else 
        cin.tie(0)->sync_with_stdio(false);
    #endif 

    while (t--) solve();

    return 0;
}