#include <vector>
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>
#include <random>
#include <unordered_map>
#include <deque>
typedef long long ll;
typedef long double ld;
using namespace std;
void update(pair<ll,ll>&A, ll n) {
	A.first += A.second;
	if (A.first == 0) {
		A.first = 2, A.second = 1;
	}
	if (A.first == n + 1) {
		A.first = n - 1, A.second = -1;
	}
}
void solve() {
	ll T; cin >> T;
	ll n, m; cin >> n >> m;
	vector<ll>a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	string s; cin >> s;
	bool N = 0, O = 0;
	for (auto x : a) {
		if (x % 2)
			N = 1;
		else
			O = 1;
	}
	if (N && O) {
		cout << "NO\n";
		return;
	}
	cout << "YES\n";
	if (T == 1)
		return;
	set<pair<ll, ll>>ind;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'L')
			ind.insert({ a[i], -1 });
		else
			ind.insert({ a[i], 1 });
	}
	if (ind.size() == 1) {
		cout << m << endl;
		if (T == 2)
			return;
		cout << 0 << endl;
	}
	auto A = *ind.begin(), B = *ind.rbegin();
	ll time = 0;
	vector<pair<ll, ll>>res;
	while (1) {
		update(A, n); update(B, n); time++;
		if (A.first == B.first) {
			res.push_back({ A.first, time });
			if (res.size() == 2)
				break;
		}
	}
	sort(res.rbegin(), res.rend());
	cout << res[0].first << endl;
	if (T == 2)
		return;
	cout << 1 << endl;
	cout << res[0].second << " " << res[0].first << endl;
}
int main()
{
	cin.tie(nullptr)->sync_with_stdio(false);
	cout.tie(nullptr)->sync_with_stdio(false);

	ll _T = 1;//cin>>_T;
	while (_T--)
		solve();
}