#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 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();auto B = *ind.rbegin();
	ll time = 0;
	if (A.second != B.second) {
		ll tA = A.first - 1;
		if (A.second == 1)
			tA = m - A.first;
		ll tB = B.first - 1;
		if (B.second == 1)
			tB = m - B.first;
		if (tA > tB) {
			swap(tA, tB);
			swap(A, B);
		}
		A.first += tA * A.second;
		B.first += tA * B.second;
		time += tA; A.second = -A.second;
		if (tA == tB) {
			time += m / 2;
			cout << m / 2 + 1 << endl;
			if (T == 2)
				return;
			cout << 1 << endl;
			cout << time << " " << m / 2 + 1 << endl;
			return;
		}
	}
	ll delta = abs(A.first - B.first) / 2;
		delta = max(delta+1, m - delta);
		cout << delta << endl;
		if (T == 2)
			return;
		time += delta - min(A.first, B.first);
		if (A.second == -1)
			time += m;
		cout << 1 << endl;
		cout << time << " " << delta << 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();
}