#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cassert>
#include <random>
#define rep(n) for (int (i) = 0; (i) < (n); (i)++)
#define all(n) (n).begin(), (n).end()
#define rall(n) (n).rbegin(), (n).rend()
#define mp make_pair
#define ll long long
#define ld long double
#define int long long
//#define FILE
//#define DEBUG

using namespace std;

int t;

void output(string verdict, int x, vector<pair<int, int>> A) {
    cout << verdict << '\n';
    if (t >= 2)
        cout << x << '\n';
    if (t == 3) {
        cout << A.size() << '\n';
        for (auto [a, b] : A)
            cout << a << ' ' << b << '\n';
    }
}

void solve() {
    cin >> t;
    int n, m; cin >> n >> m;
    vector<int> A(n);
    rep(n) cin >> A[i];
    string s; cin >> s;
    if (A[0] % 2 != A[1] % 2) {
        cout << "No\n";
        return;
    }
    else {
        if (s[0] == s[1] && A[0] == A[1]) {
            output("Yes", m, {});
        }
        else {
            int cnt = 0, x = 0;
            int y1 = A[0], y2 = A[1];
            int dir1 = s[0] == 'L' ? -1 : 1;
            int dir2 = s[1] == 'L' ? -1 : 1;
            while (true) {
                if (dir1 > dir2 && y1 <= y2) {
                    cnt += (y2 - y1) / 2;
                    x = (y1 + y2) / 2;
                    break;
                }
                else if (dir1 < dir2 && y1 >= y2) {
                    cnt += (y1 - y2) / 2;
                    x = (y1 + y2) / 2;
                    break;
                }
                else {
                    int w1 = dir1 == -1 ? y1 - 1 : (m - y1);
                    int w2 = dir2 == -1 ? y2 - 1 : (m - y2);
                    int w = min(w1, w2);
                    y1 += w * dir1;
                    y2 += w * dir2;
                    cnt += w;
                }
                if (y1 == 1 || y1 == m)
                    dir1 = -dir1;
                if (y2 == 1 || y2 == m)
                    dir2 = -dir2;
            }
            if (x >= m / 2 + 1)
                output("Yes", x, {{cnt, x}});
            else {
                cnt += m - 1;
                x = m - x + 1;
                output("Yes", x, {{cnt, x}});
            }
        }
    }
}

signed main() {
    //ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "W", stdout);
#endif
#ifndef DEBUG
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
#else

#endif
}