#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <iomanip>

using namespace std;

int main()
{
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int64_t T, n, m;
    cin >> T >> n >> m;
    if (n >= 3) {
        vector <int64_t> dd(n);
        vector <int64_t> xx(n);
        bool f1 = false;
        bool f2 = false;
        for (int64_t i = 0; i < n; ++i) {
            cin >> xx[i];
            if (xx[i] % 2) f1 = true;
            else f2 = true;
        }
        if (f1 && f2) {
            cout << "NO";
            return 0;
        } else if (T == 1) {
            cout << "YES";
            return 0;
        }
        for (int64_t i = 0; i < n; ++i) {
            char c;
            cin >> c;
            if (c == 'L') dd[i] = -1;
            if (c == 'R') dd[i] = 1;
        }
        vector <pair <int64_t, int64_t>> tt;
        for (int64_t i = 0; i < n; ++i) {
            if (dd[i] == 1) {
                tt.push_back({m - xx[i], i});
                tt.push_back({m - xx[i] + m - 1, i});
                tt.push_back({m - xx[i] + 2 * (m - 1), i});
            } else {
                tt.push_back({xx[i] - 1, i});
                tt.push_back({xx[i] - 1 + m - 1, i});
                tt.push_back({xx[i] - 1 + 2 * (m - 1), i});
            }
        }
        sort(tt.begin(), tt.end());
        int64_t answer = -1;
        for (int i0 = 0; i0 < n; ++i0) {
            for (int i1 = i0 + 1; i1 < n; ++i1) {
                vector <pair <int64_t, int64_t>> t = tt;
                vector <int64_t> d = dd;
                vector <int64_t> x = xx;
                int64_t ans = -1;
                int64_t tm = 0;
                for (int64_t i = 0; i < t.size(); ++i) {
                    int64_t l = 0;
                    if (i > 0) {
                        l = t[i - 1].first;
                    }
                    if (d[i0] != d[i1]) {
                        if ((x[i0] - x[i1]) % 2 == i0) {
                            int64_t k = (x[i0] - x[i1]) / (d[i1] - d[i0]);
                            bool t1 = (k >= i0);
                            bool t2 = (k + l <= t[i].first);
                            if (t1 && t2) {
                                int64_t y = x[i0] + d[i0] * k;
                                if (y > ans && x[3 - i0 - i1] <= y) {
                                    tm = k + l;
                                    ans = y;
                                }
                            }
                        }
                    } else if (x[i0] == x[i1]) {
                        ans = m;
                        tm = -1;
                    }
                    int64_t k = t[i].second;
                    if (d[k] == -1) {
                        x[k] = 1;
                    } else {
                        x[k] = m;
                    }
                    for (int kk = 0; kk < n; ++kk) {
                        if (kk == k) continue;
                        x[kk] += (t[i].first - l) * d[kk];
                    }
                    d[k] *= -1;
                }
                int mm = ans;
                if (mm == -1) continue;
                swap(x[3 - i1 - i0], x[0]);
                x.pop_back();
                swap(d[3 - i1 - i0], d[0]);
                d.pop_back();
                t.clear();
                int nn = 2;
                for (int64_t i = 0; i < nn; ++i) {
                    if (d[i] == 1) {
                        t.push_back({mm - x[i], i});
                        t.push_back({mm - x[i] + mm - 1, i});
                        t.push_back({mm - x[i] + 2 * (mm - 1), i});
                    } else {
                        t.push_back({x[i] - 1, i});
                        t.push_back({x[i] - 1 + mm - 1, i});
                        t.push_back({x[i] - 1 + 2 * (mm - 1), i});
                    }
                }
                sort(t.begin(), t.end());
                ans = -1;
                int64_t tmm = 0;
                for (int64_t i = 0; i < t.size(); ++i) {
                    int64_t l = 0;
                    if (i > 0) {
                        l = t[i - 1].first;
                    }
                    if (d[0] != d[1]) {
                        if ((x[0] - x[1]) % 2 == 0) {
                            int64_t k = (x[0] - x[1]) / (d[1] - d[0]);
                            bool t1 = (k >= 0);
                            bool t2 = (k + l <= t[i].first);
                            if (t1 && t2) {
                                int64_t y = x[0] + d[0] * k;
                                if (y > ans) {
                                    tmm = k + l;
                                    ans = y;
                                }
                            }
                        }
                    } else if (x[0] == x[1]) {
                        ans = mm;
                        tmm = -1;
                    }
                    int64_t k = t[i].second;
                    if (d[k] == -1) {
                        x[k] = 1;
                    } else {
                        x[k] = mm;
                    }
                    x[k ^ 1] += (t[i].first - l) * d[k ^ 1];
                    d[k] *= -1;
                }
                answer = max(answer, ans);
            }
        }
        if (answer == -1) {
            cout << "NO";
        } else {
            cout << "YES\n";
            cout << answer << "\n";
        }
    } else {
        vector <int64_t> d(n);
        vector <int64_t> x(n);
        bool f1 = false;
        bool f2 = false;
        for (int64_t i = 0; i < n; ++i) {
            cin >> x[i];
            if (x[i] % 2) f1 = true;
            else f2 = true;
        }
        if (f1 && f2) {
            cout << "NO";
            return 0;
        } else if (T == 1) {
            cout << "YES";
            return 0;
        }
        for (int64_t i = 0; i < n; ++i) {
            char c;
            cin >> c;
            if (c == 'L') d[i] = -1;
            if (c == 'R') d[i] = 1;
        }

        vector <pair <int64_t, int64_t>> t;
        for (int64_t i = 0; i < n; ++i) {
            if (d[i] == 1) {
                t.push_back({m - x[i], i});
                t.push_back({m - x[i] + m - 1, i});
                t.push_back({m - x[i] + 2 * (m - 1), i});
            } else {
                t.push_back({x[i] - 1, i});
                t.push_back({x[i] - 1 + m - 1, i});
                t.push_back({x[i] - 1 + 2 * (m - 1), i});
            }
        }
        sort(t.begin(), t.end());
        int64_t ans = -1;
        int64_t tm = 0;
        for (int64_t i = 0; i < t.size(); ++i) {
            int64_t l = 0;
            if (i > 0) {
                l = t[i - 1].first;
            }
            if (d[0] != d[1]) {
                if ((x[0] - x[1]) % 2 == 0) {
                    int64_t k = (x[0] - x[1]) / (d[1] - d[0]);
                    bool t1 = (k >= 0);
                    bool t2 = (k + l <= t[i].first);
                    if (t1 && t2) {
                        int64_t y = x[0] + d[0] * k;
                        if (y > ans) {
                            tm = k + l;
                            ans = y;
                        }
                    }
                }
            } else if (x[0] == x[1]) {
                ans = m;
                tm = -1;
            }
            int64_t k = t[i].second;
            if (d[k] == -1) {
                x[k] = 1;
            } else {
                x[k] = m;
            }
            x[k ^ 1] += (t[i].first - l) * d[k ^ 1];
            d[k] *= -1;
        }

        if (ans == -1) {
            cout << "NO";
        } else {
            cout << "YES\n";
            if (T > 1) {
                cout << ans << "\n";
            }
            if (T > 2) {
                if (tm == -1) cout << "0\n";
                else {
                    cout << "1\n";
                    cout << tm << " " << ans << "\n";
                }
            }
        }
    }
    return 0;
}
