#include<bits/stdc++.h>
#pragma GCC optimize("O3")
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>

#define ll long long
#define debug(x) cerr << (#x) <<  " = " << x << "\n";
#define pb push_back
#define pii pair < int, int >
#define pll pair < ll, ll >
#define sz(x) (ll)(x.size())
#define all(x) x.begin(), x.end()

const int N = 5e5 + 5;
const int mod = 998244353;
const ll OO = 2e9;

using namespace std;
//using namespace __gnu_pbds;

//template<typename T>
//using oset = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T>
bool umx (T &a, T b) {
    return (a < b ? (a = b, 1) : 0);
}

template<typename T>
bool umn (T &a, T b) {
    return (a > b ? (a = b, 1) : 0);
}

int add (int x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
    return x >= 0 ? x : x + mod;
}

int mul (int x, int y) {
    return 1ll * x * y % mod;
}

int power (int x, int y) {
    int res = 1;
    while (y) {
        if (y % 2)
            res = mul(res, x);
        x = mul(x, x);
        y >>= 1;
    }
    return res;
}

mt19937 rnd(42);

int a[N];
char d[N];
int T, n, m;

int apl (int x, int y, char d) {
    if (d == 'L') x -= y;
    if (d == 'R') x += y;
    return x;
}

int t = 0;

void solve (int &x, char &c, int &y, char &d) {
    int d0, d1;
    if (c == 'L')
        d0 = x - 1;
    else
        d0 = m - x;

    if (d == 'L')
        d1 = y - 1;
    else
        d1 = m - y;
    x = apl(x, min(d0,d1), c);
    y = apl(y, min(d0,d1), d);
    t += min(d0, d1);
}

int main () {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> T >> n >> m;
    set < int > kek;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        kek.insert(a[i] % 2);
    }
    for (int i = 0; i < n; ++i) {
        cin >> d[i];
    }
    if (sz(kek) == 2) {
        cout << "No";
        return 0;
    }
    cout << "Yes\n";
    if (T == 1) return 0;
    vector < pii > ans;
    while (1) {
        if (a[0] > a[1]) {
            swap(a[0], a[1]);
            swap(d[0], d[1]);
        }
        if (a[0] == 1 && d[0] == 'L')
            d[0] = 'R';
        if (a[1] == m && d[1] == 'R')
            d[1] = 'L';

        if (a[0] == a[1] && d[0] == d[1]) {
            break;
        }
        if (d[0] == 'R' && d[1] == 'L') {
            int k = (a[1] + a[0]) / 2;
            if (k <= m - k + 1) {
                t += k - a[0] + 1;
                a[0] = k + 1;
                a[1] = k - 1;
                continue;
            }
            ans.pb({t + k - a[0], k});
            break;
        }
        if (a[0] == a[1]) {
            break;
        }
        solve(a[0], d[0], a[1], d[1]);
    }
    if (!sz(ans)) cout << m << "\n";
    else cout << ans[0].second << "\n";
    if (T == 2) return 0;

    cout << sz(ans) << "\n";
    for (auto [a, b] : ans)
        cout << a << " " << b << "\n";

}
