#include "bits/extc++.h"
//#pragma optimize("O3")
//#pragma target("avx2,popcnt")
//#pragma target("unroll-loops")
using namespace std;
using namespace __gnu_pbds;
using ll = long long;

using ordered_set = tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T>
istream &operator>>(istream &is, vector<T> &a) {
    for (auto &v: a) is >> v;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os, vector<T> &a) {
    for (auto &v: a) os << v << " ";
    return (os << "\n");
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#endif

    int t;
    cin >> t;

    int n, m;
    cin >> n >> m;

    vector<int> a(n);
    vector<char> dir(n);
    int last = -1;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (last == -1) last = a[i]%2;
        if (last != a[i]%2){
            cout << "No" << "\n";
            return 0;
        }
    }
    for (int i = 0; i < n; ++i) {
        cin >> dir[i];
        if (dir[i] == 'R') a[i] = a[i] - 1;
        else a[i] = m - 1 + (m - a[i]);
    }


    cout << "Yes" << "\n";
}