#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx,avx2,bmi2,fma")
// mt19937 rnd(24523);


signed main() {
#ifdef LOCAL
    freopen("C:\\Users\\olymp\\Desktop\\VS\\input.txt", "r", stdin);
    freopen("C:\\Users\\olymp\\Desktop\\VS\\output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);

    int T, n, m, cnt0 = 0, cnt1 = 0;
    cin >> T >> n >> m;
    int _m = m;
    vector<array<int, 2>> arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i][0];
        arr[i][0]--;
        arr[i][1] = i;
        if (arr[i][0] % 2 == 0) {
            cnt0++;
        } else {
            cnt1++;
        }
    }
    vector<array<int, 2>> inp = arr;
    string s;
    cin >> s;
    if (cnt0 && cnt1) {
        cout << "No" << endl;
        exit(0);
    } else {
        cout << "Yes" << endl;
    }

    sort(arr.begin(), arr.end());
    arr.resize(unique(arr.begin(), arr.end(), [&](auto& a, auto& b) {return (a[0] == b[0] && s[a[1]] == s[b[1]]);}) - arr.begin());
    vector<array<int, 2>> left, right;
    for (auto& it : arr) {
        if (s[it[1]] == 'L') {
            left.push_back(it);
        } else {
            right.push_back(it);
        }
    }
    // for (auto& [a, b] : right) {
    //     cout << a << ' ' << b << endl;
    // }
    // cout << endl;
    // for (auto& [a, b] : left) {
    //     cout << a << ' ' << b << endl;
    // }
    // exit(0);
    vector<array<int, 2>> nx(n, {INT_MIN, INT_MIN});
    for (auto& [a, b] : arr) {
        if (s[b] == 'R') {
            int it = lower_bound(right.begin(), right.end(), array<int, 2>({a + 2, 0})) - right.begin();
            if (it < right.size()) {
                nx[b] = {right[it][1], right[it][0] - a};
            } else if (!left.empty()) {
                nx[b] = {left.back()[1], 2 * (m - 1) - left.back()[0] - a};
            } else {
                nx[b] = {right.front()[1], 2 * (m - 1) + right.front()[0] - a};
            }
        } else {
            int it = lower_bound(left.begin(), left.end(), array<int, 2>({a, 0})) - left.begin() - 1;
            if (it >= 0) {
                nx[b] = {left[it][1], a - left[it][0]};
            } else if (!right.empty()) {
                nx[b] = {right.front()[1], right.front()[0] + a};
            } else {
                nx[b] = {left.back()[1], 2 * (m - 1) - left.back()[0] + a};
            }
        }
    }
    // for (int i = 0; i < n; ++i) {
    //     if (nx[i][0] == INT_MIN) {
    //         continue;
    //     }
    //     cout << i + 1 << " | " << nx[i][0] + 1 << ' ' << nx[i][1] << endl;
    // }
    // exit(0);

    int cnt_end = 0, ind = 0;
    for (int i = 0; i < n; ++i) {
        if (nx[i][0] == INT_MIN) {
            continue;
        }
        if (cnt_end < nx[i][1] / 2 + 1) {
            cnt_end = nx[i][1] / 2 + 1;
            ind = nx[i][0];
        }
    }
    if (T >= 2) {
        cout << cnt_end << endl;
    }
    if (T == 3) {
        if (arr.size() == 1) {
            cout << 0 << endl;
            exit(0);
        }
        // cout << "F " << ind << endl;
        int t = 0, x = inp[ind][0], cnt_of_op = (int)arr.size() - 1;
        char ch = s[ind];
        vector<array<int, 2>> ans;
        while (cnt_of_op--) {
            if (ch == 'R') {
                ch = 'L';
                if (x < (m - 1) - (nx[ind][1] / 2)) {
                    t += (m - 1) - (nx[ind][1] / 2) - x;
                } else {
                    t += 2 * (m - 1) - x;
                    t += (m - 1) - (nx[ind][1] / 2);
                }
                x = (m - 1) - (nx[ind][1] / 2);
            } else if (x != (m - 1) - (nx[ind][1] / 2)) {
                t += x;
                t += (m - 1) - (nx[ind][1] / 2);
                x = (m - 1) - (nx[ind][1] / 2);
            }
            m -= (nx[ind][1] / 2);
            if (nx[ind][1] / 2 == 0) {
                exit(1);
            }
            ans.push_back({t, m});
            // if (t > 1e17 || m >= _m || (int)ans.size() > 1e6) {
            //     exit(1);
            // }
            ind = nx[ind][0];
        }
        cout << ans.size() << endl;
        for (auto& [a, b] : ans) {
            cout << a << ' ' << b << endl;
        }
    }
}

/*
3
3 5
1 3 5
RRL

own:

3
5 8
1 3 7 5 3
RRRLL


3
3 6
2 2 2
RRR

*/