#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define int long long
#define ar(x) array<int, x>

using namespace std;

void sol() {
  int T;
  cin >> T;
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  set<int> kek;
  for (int &el : a) {
    cin >> el;
    --el;
    kek.insert(el % 2);
  }
  string s;
  cin >> s;
  if (kek.size() == 1) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  if (T == 1) {
    return;
  }
  int ans = m;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int ind1 = a[i], ind2 = a[j];
      char c1 = s[i], c2 = s[j];
      int mx = 0;
      for (int _ = 0; _ < 5 * m; ++_) {
        if (ind1 == m - 1) c1 = 'L';
        if (ind1 == 0) c1 = 'R';
        if (ind2 == m - 1) c2 = 'L';
        if (ind2 == 0) c2 = 'R';
        if (c1 == 'L') --ind1;
        else ++ind1;
        if (c2 == 'L') --ind2;
        else ++ind2;

        if (ind1 == ind2) {
          mx = max(mx, ind1);
        }
      }
      ans = min(ans, mx + 1);
    }
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  // cin >> t;
  while (t--) {
    sol();
  }
}


/*
3
2 3
1 3
RL


3
2 3
1 2
RL


3
3 5
1 3 5
RRL


2
3 5
1 3 5
RRL
*/