#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using u128 = __int128_t;
using ull = unsigned long long;
using ld = long double;

#define dbg(x) cerr << #x << " = " << x << endl

const ll LINF = 2e18;
const int INF = 1e9 + 10;
const int LOG = 30;

const int N = 2e5 + 10;

void solve() {
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int &i : a) cin >> i;
    string s;
    cin >> s;

    for (int i = 0; i < n - 1; i++) {
        if ((a[i + 1] - a[i]) % 2 != 0) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
    if (T == 1) return;

    if (n == 3 && m <= 4) exit(1);

    auto deg = [](char c) {
        if (c == 'L') return -1;
        return 1;
    };
    auto rev = [](char c) {
        if (c == 'L') return 'R';
        return 'L';
    };
    auto find_pos = [&](int i, ll time) -> pair<int, char> {
        time %= 2 * m - 2;
        ll to_wall;
        if (s[i] == 'L')
            to_wall = a[i] - 1;
        else
            to_wall = (m - a[i]);
        if (time < to_wall) {
            return {a[i] + time * deg(s[i]), s[i]};
        } else {
            return {a[i] + to_wall * deg(s[i]) + (time - to_wall) * -deg(s[i]), rev(s[i])};
        }
    };
    auto wait = [&](int i, ll time) {
        auto [pos, c] = find_pos(i, time);
        ll to_wall;
        if (c == 'L')
            to_wall = pos - 1;
        else
            to_wall = (m - pos);
        return to_wall;
    };

    // auto test = find_pos(0, 2);
    // // cout << test.first << " " << test.second << endl;

    // return;
    int prev  = m;
    ll delta = 0, ps = 0;
    vector<pair<ll, int>> cuts;
    for (int i = 1; i < n; i++) {
        delta += wait(i - 1, delta);
        auto cur = find_pos(i - 1, delta);
        auto nxt = find_pos(i, delta);
        if (nxt.second == cur.second) {
            delta += wait(i, delta);
        }
        cur = find_pos(i - 1, delta);
        nxt = find_pos(i, delta);

        // cout << delta << endl;
        // cout << cur.first << " " << cur.second << endl;
        // cout << nxt.first << " " << nxt.second << endl;

        delta += abs(cur.first - nxt.first) / 2;
        int meet = (cur.first + nxt.first) / 2;
        int another = (m - meet + 1);
        if (another > meet) {
            delta += m - 1;
            meet = another;
        }
        if (meet < m) cuts.push_back({delta + ps, meet});
        for (int j = i; j < n; j++) {
            auto there = find_pos(j, delta);
            a[j] = there.first;
            s[j] = there.second;
        }
        ps += delta;
        delta = 0;
        m = meet;
    }

    cout << m << endl;
    if (T == 2) return;
    cout << cuts.size() << endl;
    for (auto [t, x] : cuts) {
        cout << t << " " << x << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed;
    cout.precision(9);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
