#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <cassert>
#include <vector>
#include <set>
#include <map>
#include <queue>

#define all(a) a.begin(), a.end()
#define int int64_t

const int INF = 1e18;

using namespace std;

int n, m;


int tim = 0;

void up(pair<int, int>& a, int kol) {
	if (a.first == 0) a.second = 1;
	if (a.first == m - 1) a.second = -1;
	int del = kol * a.second;
	if (a.first + del >= m) {
		a.first = m - (a.first + del + 1 - m);
		a.second = -1;
	} else if (a.first + del < 0) {
		a.first = -(a.first + del);
		a.second = 1;
	} else {
		a.first += del;
	}
}

void all_up(vector<pair<int, int>>& a, int kol) {
	for (int i = 0; i < n; ++i) up(a[i], kol);
}

bool is(vector<pair<int, int>>& a) {
	for (int i = 1; i < n; ++i) {
		if (a[i] != a[i - 1]) return false;
	}
	return true;
}

bool is2(vector<pair<int, int>>& a) {
	for (int i = 1; i < n; ++i) {
		if (abs(a[i].first - a[i - 1].first) % 2 != 0) return false;
	}
	return true;
}

bool can(vector<pair<int, int>>& a) {
	for (int i = 0; i < n; ++i) {
		if (a[i].first == m - 1) return false;
	}
	return true;
}

int ANS = -1;

void rec(vector<pair<int, int>> a) {
	for (int i = 0; i < n; ++i) {
		if (a[i].first == m - 1) a[i].second = -1;
	}
	if (!is2(a)) {
		return;
	}
	if (is(a)) {
		ANS = max(ANS, m);
		return;
	}
	for (int i = 0; i < m; ++i) {
		if (can(a)) {
			--m;
			rec(a);
			return;
		}
		all_up(a, 1);
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T;
	cin >> T;
	cin >> n >> m;
	vector<int> b(n);
	for (int i = 0; i < n; ++i) cin >> b[i];
	string s;
	cin >> s;
	vector<pair<int, int>> a;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'L') {
			a.push_back({ b[i] - 1, -1 });
		} else {
			a.push_back({ b[i] - 1, 1 });
		}
	}
	rec(a);
	if (ANS == -1) {
		cout << "No";
	} else {
		cout << "Yes" << '\n';
		if (T >= 2) {
			cout << ANS << '\n';
		}
	}
}