#include <bits/stdc++.h>

#define int long long
using ll = long long;
using ld = long double;
using namespace std;

const int INF = 1e18, MAXN = 1e5, mod = 998244353;

void solve();

int gg;

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int tt = 1;
    cin >> gg;
    // cin >> tt;
    while (tt--) {
        solve();
        cout << "\n";
    }
}


void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> arr(n);
    string s;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        arr[i]--;
    }
    cin >> s;
    vector<int> aa, bb;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') {
            aa.push_back(arr[i]);
        } else {
            bb.push_back(arr[i]);
        }
    }

    sort(aa.begin(), aa.end());
    sort(bb.begin(), bb.end());
    bool check = true;
    for (int i = 1; i < (int) aa.size(); i++) {
        if (aa[i] - aa[i - 1] == 1) {
            check = false;
        }
    }

    for (int i = 1; i < (int) bb.size(); i++) {
        if (bb[i] - aa[i - 1] == 1) {
            check = false;
        }
    }
    if (!aa.empty() && !bb.empty()) {
        if (aa.back() == m - 1 && bb.back() == m) {
            check = false;
        }
        if (aa.front() == 0 && bb.front() == 1) {
            check = false;
        }
    }


    if (check) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}
