//#pragma GCC optimize("Ofast", "unroll-loops")
#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 print(string verdict, int x=-1, vector<pair<int, int>> A={mp(-1, -1)}) {
    cout << verdict << '\n';
    if (T == 1 || verdict == "No") return;
    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;

    int y1 = A[0], y2 = A[1];
    int dir1 = s[0] == 'L' ? -1 : 1;
    int dir2 = s[1] == 'L' ? -1 : 1;

    int cnt = 0, x = -1;
    rep(m * 5) {
        if (y1 == y2) {
            if (y1 > x) {
                x = y1;
                cnt = i;
            }
        }

        if (y1 == 1) dir1 = 1;
        else if (y1 == m) dir1 = -1;

        if (y2 == 1) dir2 = 1;
        else if (y2 == m) dir2 = -1;
        
        y1 += dir1;
        y2 += dir2;
    }
    if (x == -1)
        print("No");
    else
        print("Yes", x, {mp(cnt, x)});
}

int 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
}