#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>

using namespace std;
using ll = long long;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(0);

	int t, n, m;
	cin >> t >> n >> m;
	vector<int> a(n);
	string s;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	cin >> s;
	set<int> st;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'R') {
			st.insert(a[i] - 1);
		}
		else if (a[i] == 1) {
			st.insert(0);
		}
		else {
			st.insert(2 * m - 1- a[i]);
		}
	}
	int cn = 0;
	for (auto i : st) {
		if (i % 2 == 0) {
			cn |= 1;
		}
		else {
			cn |= 2;
		}
	}
	if (cn == 3) {
		cout << "No\n";
		return 0;
	}
	else {
		cout << "Yes\n";
	}
	if (t == 1) return 0;
	vector<int> vv;
	for (auto i : st) {
		vv.push_back(i);
	}
	int rs = 2 * m - 3 - vv.back() + vv[0];
	int ib = vv.size() - 1;
	for (int i = 0; i + 1 < vv.size(); ++i) {
		if (vv[i + 1] - vv[i] >= rs) {
			rs = vv[i + 1] - vv[i];
			ib = i;
		}
	}
	cout << (rs + 1) / 2 + 1 << '\n';
	if (t == 2) return 0;
	cout << vv.size() - 1 << '\n';

	int cq = 2 * m - 2;

	int cur_time = 0;
	if (vv[ib] < m) {
		cur_time += m - 1 - vv[ib];
	}
	else {
		cur_time += m - 1 + cq - vv[ib] - 1;
	}
	n = vv.size();
	for (int i = 0; i < n; ++i) {
		vv[i] += cur_time;
		vv[i] %= cq;
	}

	sort(vv.begin(), vv.end());

	int fk = find(vv.begin(), vv.end(), m - 1) - vv.begin();
	vector<int> lns;

	for (int i = fk; i > 0; --i) {
		lns.push_back(vv[i] - vv[i - 1] - 1);
	}
	if (fk != n - 1) {
		lns.push_back(vv[0] + cq - 1 - vv.back());
	}
	for (int j = n - 2; j > fk; --j) {
		lns.push_back(vv[j + 1] - vv[j] - 1);
	}
	for (int i = 0; i < lns.size(); ++i) {
		cur_time += (lns[i] + 1)/2;
		m -= (lns[i] + 1) / 2;
		cout << cur_time << ' ' << m << '\n';
	}

	return 0;
}
