#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define Vector2 pair <int, int>
#define print(a) for (const auto& x : a) cout << x << ' ';

void solve()
{
	int T;
	cin >> T;
	int n, m;
	cin >> n >> m;
	vector <int> a(n);
	bool flag1 = true, flag2 = true;
	for (auto& x : a) {
		cin >> x;
		if (x % 2) {
			flag1 = false;
		}
		if (!(x % 2)) {
			flag2 = false;
		}
	}
	string s;
	cin >> s;
	if (!flag1 && !flag2) {
		cout << "No\n";
		return;
	}
	cout << "Yes\n";
	if (T != 1) {
		int md = 2 * m - 2;
		int pos1 = ((s[0] == 'R' ? a[0] - 1 : 1 - a[0]) % md + md) % md;
		int pos2 = ((s[1] == 'L' ? a[1] - 1 : 1 - a[1]) % md + md) % md;
		if (pos1 == pos2) {
			cout << m << '\n';
			if (T == 3) {
				cout << "0\n";
			}
			return;
		}
		int diff = min((pos1 - pos2 + md) % md, md - (pos1 - pos2 + md) % md);
		int cur = ((pos1 - pos2 + md) % md <= md - (pos1 - pos2 + md) % md ? pos1 : pos2) + diff;
		cout << m - diff / 2 << '\n';
		if (T == 3) {
			cout << "1\n";
			cout << ((m - cur) % md + md) % md << '\n';
		}
		return;
	}
}

signed main()
{
	cin.tie(nullptr)->ios_base::sync_with_stdio(false);
	solve();
	return 0;
}