#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <experimental/random>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ordered_set = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
using str = string;
using ld = long double;
const ll INF = 1e9, MOD = 998244353;
#define int long long

void solve();

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    // cin >> _;
    while (_--) {
        solve();
        // cout << "\n";
    }
}

int T;

void solve() {
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i]--;
    }
    str s;
    cin >> s;
    {
        vector<bool> us(2);
        for (int i = 0; i < n; ++i) {
            if (s[i] == 'L') {
                us[a[i] % 2] = true;
            } else {
                us[(-a[i] % 2 + 2) % 2] = true;
            }
        }
        if (us[0] && us[1]) {
            cout << "No\n";
            return;
        } else {
            cout << "Yes\n";
        }
    }
    if (T == 1) {
        return;
    }
    if (n == 2) {
        {
            cout << 2 << "\n";
        }
        if (T == 3) {
            vector<pair<int,int> > Ans;
            vector<pair<int, char> > t = {{a[0], s[0]}, {a[1], s[1]}};
            sort(t.begin(), t.end());
            t[1].second = 'R';
            Ans.push_back({0, t[1].first + 1});
            if (t[0].second == 'L') {
                Ans.push_back({t[0].first, t[1].first - t[0].first + 1});
                t[1].first -= t[0].first;
                int C = t[0].first;
                t[0].first = 0;
                Ans.push_back({C + t[1].first / 2, t[1].first / 2 + 1});
                Ans.push_back({C + t[1].first, 2});
            } else {
                int C1 = t[1].first - t[0].first;
                Ans.push_back({t[0].first + C1, t[1].first - t[0].first + 1});
                t[1].first -= t[0].first;
                int C = t[0].first;
                t[0].first = 0;
                Ans.push_back({C + t[1].first / 2 + C1, t[1].first / 2 + 1});
                Ans.push_back({C + t[1].first + C1, 2});
            }
            vector<pair<int,int> > Ans1;
            int mn = -INF, mx = m;
            for (auto k: Ans) {
                if (k.first < mn) {
                    continue;
                }
                mn = k.first;
                if (k.second >= mx) {
                    continue;
                }
                mx = k.second;
                Ans1.push_back(k);
            }
            cout << Ans1.size() << '\n';
            for (auto w: Ans1) {
                cout << w.first << " " << w.second << "\n";
            }
        }
    }
}
