




#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1e18 + 7;
void ans(int T, ll pos, ll m, ll t) {
	cout << max(pos, m - pos + 1) << "\n";
	if (T == 2) {
		return;
	}

	if (max(pos, m - pos + 1) == m) {
		cout << "0\n";
		return;
	}
	cout << 1 << "\n" << t << ' ' << max(pos, m - pos + 1) << "\n";
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	ll T;
	cin >> T;
	ll n, m;
	cin >> n >> m;
	vector<ll>a(n);
	for (ll i = 0; i < n; ++i) cin >> a[i];
	string s;
	cin >> s;
	ll cnt = 0;
	for (auto x : a) {
		cnt += x & 1;
	}
	if (cnt != 0 && cnt != n) {
		cout << "No\n";
		return 0;
	}
	cout << "Yes\n";
	if (T == 1) {
		return 0;
	}
	if (a[0] == a[1] && s[0] == s[1]) {
		if (T == 2) {
			cout << m << "\n";
			return 0;
		}
		if (T == 3) {
			cout << m << "\n" << 0 << "\n";
			return 0;
		}
		return 0;
	}

	int mx = 0, mxt = 0;

	ll timer = 0;
	for (int i = 0; i < 2 * m; ++i) {
		int pos = a[0];
		bool ok = true;
		for (int j = 0; j < n; ++j) {
			if (a[j] != pos) {
				ok = false;
			}
		}
		if (ok) {
			if (mx < pos) {
				mx = pos;
				mxt = i;
			}
		}
		ll t = LINF;
		if (a[0] > a[1]) {
			swap(a[0], a[1]);
			swap(s[0], s[1]);
		}
		if (s[0] == 'R' && s[1] == 'L' && a[0] != a[1]) {
			t = (a[1] - a[0]) / 2;
		}
		if (s[1] == 'R') t = min(t, m - a[1]);
		if (s[0] == 'R') t = min(t, a[0] - 1);

		timer += t;
		for (int j = 0; j < n; ++j) {
			
			if (s[j] == 'L') {
				a[j]-=t;
			}
			else {
				a[j]+=t;
			}
			if (a[j] == 1) s[j] = 'R';
			else if (a[j] == m) s[j] = 'L';
		}

	}
	ans(T, mx, m, mxt);
	
}